>>declare Sleep in Win32api integer >>do while !empty(WordObj.Application.BackgroundPrintingStatus) >> =Sleep(2000) >>enddo >>>
DocumentPath = '\tmp\test.doc' WordObj = CreateObject('Word.Application') =WordObj.Documents.Open(DocumentPath) #define wdDialogFilePrint 88 with WordObj.ActiveDocument.Application.Dialogs(wdDialogFilePrint) *.Printer = PrinterName .numcopies = 1 .Execute() endwith #undefine wdDialogFilePrint &&WordObj.ActiveDocument.PrintOut(FALSE,,,,,,,) do while !empty(WordObj.Application.BackgroundPrintingStatus) =sleep(2000) enddo #define wdDoNotSaveChanges 0 &&WordObj.ActiveDocument.Close(wdDoNotSaveChanges) WordObj.Quit(wdDoNotSaveChanges) #undefine wdDoNotSaveChanges