Word 2000 Print Events

J

James

Hi,

I am using Visual Studio.net 2003 with Word 2000 to automate the printing of
several documents. I have run into a problem where I need to close the
current document after it has been printed, but the document is being closed
before it has been sent to the printer (see code sample below). I really need
some sort of AfterPrint event to clean up after the document has been
printed, but the Word object model does not expose an AfterPrint event. Is
there another event or property I could use which would be suitable for this?
The only alternative I can think of is to introduce a pause of a few seconds
to give the document time to spool.

Any advice would be much appreciated.

Code sample:

mobjWord.ActiveDocument.PrintOut() ' Print letter
mobjWord.ActiveDocument.Close(WdSaveOptions.wdDoNotSaveChanges) ' Close
current document
RaiseEvent DocumentClosed(Me, New System.EventArgs()) ' Raise event to client
mobjWord.Quit(0,0) ' Close Word
RaiseEvent Disposed(Me, New System.EventArgs())
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top