PDA

View Full Version : Printout before ActivePrinter through changing?



let98007
06-08-2009, 03:39 PM
I have an automation routine in Visual FoxPro that does the following (Yes, the syntax is correct--at least for VFP!)
SavedPrinter = .ActivePrinter
.ActivePrinter = this.getprinter()
.ActiveDocument.PrintOut()
IF .ActivePrinter <> SavedPrinter
.ActivePrinter = SavedPrinter
Endif
Occasionally, and always when switching to the PDF Converter, the print command seems to be issued before .ActivePrinter is done connecting to the PDF Converter. This results in a dialog box from Word asking for a document name and directory to send the document to the wrong (paper) printer. The only 'correct' answer to this dialog is Cancel. This happens about 1 time out of 500 on the network (I've never seen it here) but it's still a problem. The PDF converter is installed locally on every workstation. Is there a way to detect that the .ActivePrinter= PDFConverter process has completed before issuing the .PrintOut() command?