|
-
Mar 24th, 2006, 03:45 PM
#1
Thread Starter
Member
stall between printing and closing
I have an open document that I want printed and then closed. here is the code
VB Code:
ActiveDocument.PrintOut
Kill "temp.doc"
ActiveDocument.Close False
Application.Quit False
I want it to print the active document, delete the temp.doc file, close the document and then close word.The problem is it all happens too fast that it doesn't print the active document.
Any ideas on how to do this?
-
Mar 24th, 2006, 04:29 PM
#2
Re: stall between printing and closing
try inserting a after the printout line.
Declan
Don't forget to mark your Thread as resolved.
Take a moment to rate posts that you think are helpful 
-
Mar 25th, 2006, 10:08 AM
#3
Re: stall between printing and closing
2 things. First, don't try to kill the document until after it has been closed. Second, you can use the BackgroundPrintingStatus property to see if Word has uncompleted print jobs:
VB Code:
ActiveDocument.PrintOut
Do Until Application.BackgroundPrintingStatus = 0
DoEvents
Loop
ActiveDocument.Close False
Application.Quit False
Kill "temp.doc"
-
Feb 13th, 2010, 12:34 PM
#4
Addicted Member
Re: stall between printing and closing
This last suggestion works, but there is a long (minute or more) delay before printing...
Unless I put a break point at the DoEvents, then it seems to trigger an immediate print.
Any suggestions how to trigger it immediately in code?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|