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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing a Word Document and Closing Word

Status
Not open for further replies.

coolscan3

Programmer
Joined
Oct 23, 2001
Messages
40
Location
GB
I am trying to Open Word, Print a Document and then Close Word Using the Following Code

Private Sub Command0_Click()
Dim w As Object


Set w = CreateObject("word.application")
w.Visible = True
w.Documents.Open "c:\mydoc.doc"
w.ACTIVEDOCUMENT.PrintOut
w.ACTIVEDOCUMENT.Close

w.Quit


The Problem is when Word Quits I Get a dialogue box saying

Word is Currently Printing. Quiting Word will cancel all pending print jobs. Do you want to quit Word

As anyone any solutions ?
 
w.Documents.Open "c:\mydoc.doc"
w.Options.PrintBackground = false ' No print "in background"
w.ACTIVEDOCUMENT.PrintOut
w.ACTIVEDOCUMENT.Close

w.Quit false ' do not save changes

Compare Code (Text)
Generate Sort in VB or VBScript
 
The Code Works fine

Thanks for your response
 
That is just a message that Windows has started using with the new verions. If you open a document in Word itself and try to close right after you start a print job, you will get the same message.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top