Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automating Microsoft Word in VB 1

Status
Not open for further replies.

LegoPiece

Programmer
Mar 19, 2001
95
0
0
US
This is a two-part dilemma that I'm having a hard time with. I have a VB app which uses Word in the background to open, save and print a Word document.

My FIRST problem is to do with synchronization - i.e. I need to determine when Word is done printing, so that I can get it to do something else, like opening another document or perform a save as. My question is : are multiple requests handled by the Word Object, or is there an event like DonePrinting() that tells me when the document is done?

My SECOND problem is to stop Word when I'm done with the object. I do a Set [Word Object] = Nothing, however my task manager still shows WINWORD.EXE running in the processes, long after I've closed out of my app. How do I stop it?

Peace
Lego

"People have accused us of releasing the same album 16 times - that's simply not true. We've released the same album 17 times!" - Angus Young, AC/DC
 
Lego,

FIRST
I'm suprised if you need to 'synchronize'; the printout will be sent to the Windows spooler, so as far as your app is concerned printing will be over very quickly; you should just be able to continue doing other stuff while printing is taking place.

SECOND
I assume you are preceding set WordObj = Nothing with WordObj.Quit if not do it.

regards Hugh
 
When printing I've found it best to set the Background parameter of the Print method to False. This ensures that Word finished printing before moving on to the next task.

Andy
--
"Logic is invincible because in order to combat logic it is necessary to use logic." -- Pierre Boutroux
 
Andy,

Dumb question, but do I set this parameter in Word, or is there a property in the Word Object's Print Out (or some other) method that allows me to do this? Thanks!

-------
Hugh,

I have the Word Object wrapped up inside an ActiveX DLL, which my client application uses to open a template document, stuff text data into it (using bookmarks), save to a different file name and then print out before moving to the next document. I just want to make sure that the initial document is done doing what it's supposed to before closing out and repeating the process. I'm pretty sure I did the WordObject.Quit before setting it to Nothing, but I'll double-check on that. Is it possible that WINWORD.EXE is still hanging around because I told it to quit WHILE it was sending the doc to the printer?

Thanks for the help - much appreciated!

Peace
Lego

"People have accused us of releasing the same album 16 times - that's simply not true. We've released the same album 17 times!" - Angus Young, AC/DC
 
>>the printout will be sent to the Windows spooler, so as far as your app is concerned printing will be over very quickly; you should just be able to continue doing other stuff while printing is taking place

Not if you are printing to a PDF printer or another type of doc maker printer.

>>but do I set this parameter in Word, or is there a property in the Word Object's

objDoc.PrintOut Background:=False
 
Sweeeeeet- Sounds like my dilemmas are coming to a close on this one!

Thanks for the help!

Peace
Lego

"People have accused us of releasing the same album 16 times - that's simply not true. We've released the same album 17 times!" - Angus Young, AC/DC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top