How to find out whether Word has finished printing

Article contributed by Jonathan West

Often, Word is controlled from another application, where the application starts Word, prints one or more documents, and then closes Word. (See Control Word from Excel for how to open Word from another application.)

A common problem is that Word normally prints in the background, so you might close Word while it is still generating the print file.

There are two ways to avoid this
  

1.

Set the Background parameter of the PrintOut method to False, so that the next line of code doesn't execute until the print file has been spooled to the printer queue.

ActiveDocument.Printout Background:=False

2.

Check the BackgroundPrintingStatus property of Word's Application object, and don't close Word until the value reaches zero. To make sure that you aren't unnecessarily delaying the printing process by eating cycles within the same thread, use a timer that triggers a check every few seconds.

Generally, option #1 is safer, because Word can sometimes get a bit confused if asked to background print too many documents at once.