|
-
February 20th, 2003, 01:01 PM
#1
How do I keep MS Word open when opened by MS Access
How do I keep MS Word open when opened by MS Access
I am writing an MS Access application. This code snippet just opens MS world and closes immediately. This is not what I want. I want to be able to leave it open long enough to edit it.
Dim objWord As Word.Application
…
Function OpenAWord_Maybenot(wordDocStr As String)
If TypeName(objWord) <> "Application" Then
'Start Microsoft Word 97.
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
objWord.Documents.Open (wordDocStr)
'Quit Microsoft Word and release the object variable.
objWord.Quit
Set objWord = Nothing
End If
End Function
-
February 20th, 2003, 02:52 PM
#2
The problem is in your function, you open word and you close it as soon as it is open. Those lines closes word:
'Quit Microsoft Word and release the object variable.
objWord.Quit
Set objWord = Nothing
When word closes, the document also closes, so don't close word until you're done with any documents you opened.
JeffB
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|