Microsoft small business knowledge base

Article ID: 241942 - Last Review: February 21, 2014 - Revision: 2.2

This article was previously published under Q241942
This article has been archived. It is offered "as is" and will no longer be updated.


When using OLE Automation to Microsoft Word 2000 or Microsoft Word 97 for Windows SR-1 or higher that prints a file, and then releases, closes, or quits the Word object, the following warning message might appear:
Word is currently printing. Quitting Word will cancel all pending print jobs. Do you want to quit Word?
The BackgroundPrintingStatus property of the Word.Application object returns the number of jobs in Word's Background Printing queue. By checking the value of this property, you can avoid the error message without disabling Background Printing.


The following sample code shows one way to use this property:
oWord = CREATEOBJECT('Word.Application')
WITH oWord
   .Visible = .T.
   .Selection.InsertAfter("Mark, why does that crate have air holes?")
   DO WHILE .BackgroundPrintingStatus > 0
      DOEVENTS()        && Make sure you leave the OS enough time to update 
                        && the property
      *!* =INKEY(.1)	&& Use INKEY if you're running under VFP 3.0 
   .Application.Quit(0) && Quit, don't save and don't prompt


For additional information, click the article number about suppressing errors in Word below to view the article about suppressing errors in Word in the Microsoft Knowledge Base:
170393  ( ) How To Prevent Word Printing Error with OLE Automation

  • Microsoft Visual FoxPro 3.0 Standard Edition
  • Microsoft Visual FoxPro 3.0b Standard Edition
  • Microsoft Visual FoxPro 5.0 Standard Edition
  • Microsoft Visual FoxPro 5.0a
  • Microsoft Visual FoxPro 6.0 Professional Edition
kbnosurvey kbarchive kbautomation kbhowto KB241942
Additional support options
Ask The Microsoft Small Business Support Community
Contact Microsoft Small Business Support
Find Microsoft Small Business Support Certified Partner
Find a Microsoft Store For In-Person Small Business Support