Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / May 2006

Tip: Looking for answers? Try searching our database.

Word 2000 Print Events

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
James - 23 May 2006 13:40 GMT
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())
Jonathan West - 23 May 2006 13:44 GMT
Hi James

take a look here

How to find out whether Word has finished printing
http://www.word.mvps.org/FAQs/MacrosVBA/WaitForPrint.htm

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org

> Hi,
>
[quoted text clipped - 24 lines]
> mobjWord.Quit(0,0) ' Close Word
> RaiseEvent Disposed(Me, New System.EventArgs())
James - 25 May 2006 13:17 GMT
Jonathan,

Many thanks, just what I was after!

James

> Hi James
>
[quoted text clipped - 31 lines]
> > mobjWord.Quit(0,0) ' Close Word
> > RaiseEvent Disposed(Me, New System.EventArgs())
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.