Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Developer Toolkits / April 2005

Tip: Looking for answers? Try searching our database.

Using Word from Access

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tom Budlong - 25 Mar 2005 02:29 GMT
I am manipulating several Word Documents from Access 2002. But efficiently
opening Word and the documents has eluded me. What I want is:

If Word is open use that instance, else open a new instance.
Then,
If the document is open, use it, else open it.

Fantasy-code looks like:

If IsOpen ("Word") = False Then Set objWord = New Word.Application
and,
If IsOpen ("MyDocument') then Open....

Can anyone suggest real code?

Many thanks
Mel - 23 Apr 2005 15:28 GMT
Here is a copy of the routine I use:
---------
'The Calling program has: Dim objWord As Object

Sub InitializeWord(objWord As Object)
Const wdWindowStateMaximize As Integer = 1
 On Error Resume Next  'If Word is not already running, start it
 Set objWord = GetObject(, "Word.Application")
 If (Err <> 0) Then
   Err.Clear
   Set objWord = CreateObject("Word.Application")
 End If

 On Error GoTo PROC_ERR
 objWord.Visible = True
 objWord.CommandBars("Standard").Visible = True
 objWord.CommandBars("Formatting").Visible = True
 objWord.WindowState = wdWindowStateMaximize 'Maximize
 Exit Sub

PROC_ERR:
 MsgBox "The following error occurred: " & Error$
 Resume Next

End Sub
----------

Regards,
Mel Woolsey

>I am manipulating several Word Documents from Access 2002. But efficiently
> opening Word and the documents has eluded me. What I want is:
[quoted text clipped - 12 lines]
>
> Many thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.