bottom
Great WordTips!
         
Your e-mail address is safe!
Close Note

Tips.Net > WordTips Home > Macros > Printing and Exiting Word in a Macro

Printing and Exiting Word in a Macro

Summary: When you print a document, Word remains busy in the background until the printing is done. If you try to end the program before printing is done, you can cause problems for your printout. This tip explains how to bypass the potential problem by making just a small change to how the document is printed. (This tip works with Microsoft Word 97, Word 2000, Word 2002, Word 2003, and Word 2007.)

Robert needs a macro that will load a document, print it out, and then exit Word. He's figured out how to load the document and start to print it, but when he tells the macro to exit Word, he sees a message saying that if he quits, any printing will be deleted.

This message is displayed because the default method for printing in Word is to print in the background, which means that the command to shut down Word is executed while the printing is still going on in the background. The solution is to make sure that background printing is turned off in the print command:

ActiveDocument.PrintOut Background:=False

Since printing will be done in the "foreground," the next macro command will not be executed until the printout is complete. In this way, the printing is very much like printing from within Windows itself: right-click a document and choose Print from the Context menu, and Word is loaded, the document printed, and Word then shuts down.

Tip #450 applies to Microsoft Word versions: 97 | 2000 | 2002 | 2003 | 2007


Ultimate Library! The most amazing collection ever offered in the history of WordTips places every tip—present and historical—at your fingertips. Check out the WordTips Ten-Year Library.

Helpful Links

Ask a Word Question
Make a Comment

Tips.Net Home
Vital News Home

WordTips FAQ
WordTips Premium

Learn Access Now

Beauty Tips
Bugs and Pests Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pet Tips
Word2007 Tips
WordTips

Advertise on the
WordTips Site

 

Great Info!

Get tips like this every week in WordTips, a free productivity newsletter. Enter your e-mail address and click "Subscribe."
     
(Your e-mail address will never be shared with anyone, ever.)