Closing Word 2000 from Access 2000

  • Thread starter Thread starter jokobe
  • Start date Start date
J

jokobe

I'm opening Word 2000 Document from Acc 2000
Set WordDoc = wordApp.Documents.Open(stappname)
With wordApp
'make the application visible
.Visible = True
'open the doucment
.Documents.Open (" " & strDocName & " ")

and later the document and Word is closed:
oDoc.Close
wordApp.Quit)

On the surface this is working fine, the document is closed and word is
gone. But when having a look at the task manager, there is still a Winword
service running. After opening and closing a five docs, there are running
five Winword processes.
Any helpful hints?

jokobe
 
As well as closing the word doc and quitting Word, you need to set the
reference to nothing.
In the line > Set WordDoc = wordApp.Documents.Open(stappname)
you have set a reference to Word
To fully close the Word app you have to remove that reference to Word when
you are exiting the sub or function.
You do this by coding
Set WordDoc = Nothing

So the end of your code looks like this:

oDoc.Close
wordApp.Quit
Set WordDoc = Nothing

Jeanette Cunningham
 
Hi Jeanette,
thanks for your quick answer,
indeed the missing "set nothing" was the error....

have a nice weekend

jokobe
 
Back
Top