winword.exe keeps running

winword.exe keeps running

Post by TWVkREJ » Sun, 15 May 2005 02:33:16


In vb6 I have developed a user-control.
It opens an rtf file in word using automation.
Here's the code:

Set wrdApp = CreateObject("WORD.Application")
wrdApp.Documents.Open FileName:="C:\TempReportZ.rtf"
wrdApp.Documents.Item("TempReportZ.rtf").Activate
wrdApp.PrintOut
Set wrdApp = Nothing

After this runs and prints out the file the winword.exe continues to exist
in TaskManager. Even when the user-control is closed.
I've tried 'wrdApp.quit' but get a warning dialog asking if I want to quit
while printing is going on.
I also tried 'wrdApp.BackgroundPrintingStatus' with no luck.
Any ideas on how to kill the winword.exe after the printing is finished?

Thank you.
 
 
 

winword.exe keeps running

Post by Randy Birc » Mon, 16 May 2005 00:21:00

You should ask this in a VBA newsgroup, but I believe the Quit command takes
additional parameters, one of which instructs to suppress the prompt dialog.

--

Randy Birch
MS MVP Visual Basic
http://www.yqcomputer.com/
----------------------------------------------------------------------------
Read. Decide. Sign the petition to Microsoft.
http://www.yqcomputer.com/
----------------------------------------------------------------------------





: In vb6 I have developed a user-control.
: It opens an rtf file in word using automation.
: Here's the code:
:
: Set wrdApp = CreateObject("WORD.Application")
: wrdApp.Documents.Open FileName:="C:\TempReportZ.rtf"
: wrdApp.Documents.Item("TempReportZ.rtf").Activate
: wrdApp.PrintOut
: Set wrdApp = Nothing
:
: After this runs and prints out the file the winword.exe continues to exist
: in TaskManager. Even when the user-control is closed.
: I've tried 'wrdApp.quit' but get a warning dialog asking if I want to quit
: while printing is going on.
: I also tried 'wrdApp.BackgroundPrintingStatus' with no luck.
: Any ideas on how to kill the winword.exe after the printing is finished?
:
: Thank you.
: