Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I suppress the MS Word print progress dialog

COM and Automation

How can I suppress the MS Word print progress dialog

by  ChrisRChamberlain  Posted    (Edited  )
If you simply want to print an MS Word.doc and do not want to see either the print progress dialog or an instance of MS Word, try the following :-
[color blue]
LOCAL lcFile, oWord, oDocument, hWin, lnAnswer
lcFile = [C:\test\test.doc]

DECLARE INTEGER GetDesktopWindow IN WIN32API
DECLARE INTEGER LockWindowUpdate IN WIN32API INTEGER lnHandle

oWord = CreateObject([Word.Application])
oDocument = oWord.Documents.Open(lcFile)

oWord.Options.PrintBackGround = .F.

hWin = oMain.HWnd[color green] && Object reference to active VFP window[color blue]
LockWindowUpdate(hWin)

lnAnswer = MESSAGEBOX([Do you want to print ];
+ lcFile;
+ [?],;
4 + 32 + 0,;
[Print file])
IF lnAnswer = 6
oDocument.PrintOut()
ENDI

LockWindowUpdate(0)

oDocument.Close()
oWord.Quit()
RELEASE oWord
[color black]
Have fun!

ChrisRChamberlain
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top