|
-
Dec 29th, 1999, 02:59 AM
#1
Thread Starter
Hyperactive Member
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).]
-
Dec 29th, 1999, 06:00 AM
#2
Hyperactive Member
I have the same problem. I cant get the instance of word to go away.
------------------
I am so skeptacle, I can hardly believe it!
-
Dec 29th, 1999, 11:13 AM
#3
Guru
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
-
Dec 29th, 1999, 10:58 PM
#4
Thread Starter
Hyperactive Member
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!
-
Dec 29th, 1999, 11:35 PM
#5
Lively Member
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
-
Dec 30th, 1999, 01:00 AM
#6
Thread Starter
Hyperactive Member
Thanks for your note Roger,
Tom, also put the false but, I ignored.
Thanks to both!
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
|