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!

Close document after printing automated code needed please! 1

Status
Not open for further replies.

adscrims

Programmer
Aug 21, 2001
24
0
0
GB
Does anybody know any code on: only quit an active documnent after the print jobs have finished. Currently my code does this. It opens a document prints it and quits word. However an error message occurs which says do you want to quit before printing is complete. Hope this is clear Andy Thanks in advance :-9
 
Hi adscrims,
I had this problem a few months back when working with Word 97. I cant remember specifics (i.e. error numbers or anything like that but by the looks of things i worked around this by simply delaying CPU operation for a few seconds. As i understood it the problem was the file being written to the printer buffer or something similiar. This worked for me and hopefully it should work for you...

'the sleep function-i.e. stops the program operating for a defined time..
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

'the actual code- just from the print stage...

wrdapp.PrintOut

'delay for 10 secs to allow the data to get to the buffer..
Call Sleep(10000)

wrdapp.Quit wdDoNotSaveChanges

Set wrdapp = Nothing

Again i dont know the specifics but it worked for me..

Write back if you encounter any more problems and i will try to help you out.. I remember how frustrating it was trying to get my program working!!!!


Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top