-
I am able to open and print the document, but when I try to close the Word app, I get the message that it is still printing.... How do I have it wait until the printing is done to close?
This is my code, any suggestions will be greatly appreciated.
Dim WordApp As Object
Set WordApp = CreateObject("Word.Application")
WordApp.Visible = False
WordApp.Documents.Open (MyDocument)
WordApp.ActiveDocument.Printout
WordApp.ActiveDocument.Close
WordApp.quit
Set WordApp = Nothing
Thank you for your help.
-
Ran into that before. We used a message box that said to click ok whenever the document was done printing.
-
The first option on the "PrintOut" command is Background. This indicates if the macro will continue while Word prints it out and is defaulted to TRUE.
If you were to do :
Code:
WordApp.ActiveDocument.Printout FALSE
I believe with this your code will not even attempt to execute the next line until printing has finished.
-
Thank you very much for your help!!!