-
I'm opening a Word object in two diferent ways but, the Instance of Word is still in memory all time later.
Method 1
Code:
Dim objWord As New Word.Application
objWord.Visible = False
objWord.Documents.Open "Document.doc"
objword.Printout
objWord.Documents.Close
Set objWord = Nothing
Method 2
Code:
Dim docWord as Object
Set docWord = CreateObject("Word.Basic")
docWord.FileOpen ("document.doc")
docWord.FilePrint
docWord.FileClose
Set docWord = Nothing
I'm using the Word 8 reference. In both cases the Word instance stay on memory. I think the 'Set DocWord = Nothing' is not the correct sentence to close the Word instance.
Any idea will be deeply apreciated.
Thanks!
[This message has been edited by Tonatiuh (edited 12-29-1999).]
-
I have the same problem. I cant get the instance of word to go away.
------------------
I am so skeptacle, I can hardly believe it!
-
You're not using the word.application.quit method. This example uses Word 9.0 (probably work in 8 as well)
Code:
Dim wd As Word.Application
Set wd = New Word.Application
wd.Documents.Open "D:\My Documents\Address.doc"
wd.Documents.Close False
wd.Application.Quit
Set wd = Nothing
Winword is removed from memory, as shown by my close program box.
HTH
Tom
-
Thanks Tom,
But, I have a nother problem now.
Code:
objWord.Documents.Open "Doc1.doc"
objWord.PrintOut
DoEvents
objWord.Documents.Close
objWord.Quit
Set objWord = Nothing
And I recive this message:
Word is currently printing. Quitting Word will cancel all pending print jobs. Do you want to quit Word?
If I choose NO. Prints OK but doesn't quit it.
If I choose Yes. It quits Word OK but doesn't prints.
Is there any way to know when Word print job has finished?
Really thanks!
Happy New Year!
-
Hi,
use
Code:
objWord.Documents.Open "Doc1.doc"
objWord.PrintOut False
DoEvents
objWord.Documents.Close
objWord.Quit
Set objWord = Nothing
The False parameter after PrintOut prevents Word from printing in background and it will return to your code when printing is fully completed.
Happy New Year
Roger
-
Thanks for your note Roger,
Tom, also put the false but, I ignored.
Thanks to both!