local lcError, loErr, lcFileExt, llPrinted, oPrnDev llPrinted = .f. if not empty(thisform.cReportFile) lcFileExt = lower(justext(thisform.cReportFile)) try do case case inlist(m.lcFileExt,'txt','prn','dat') oPrnDev = newobject("PrintDev","RawPrint.vcx") oPrnDev.cDocName = "Printing " + justfname(thisform.cReportFile) oPrnDev.cPrinterName = set('printer', 3) && Default Printer if oPrnDev.oOPen() oPrnDev.cFilename = thisform.cReportFile oPrnDev.oPrintFile() oPrnDev.oClose() llPrinted = .t. else * Error opening device; display error number =ErrorMsg("OpenPrinter() Error: " + str(oPrnDev.nOpenError)) endif case m.lcFileExt = 'pdf' =PrintPDF(thisform.cReportFile) otherwise =ErrorMsg("Printing of " + m.lcFileExt + " is not currently supported.") endcase catch to loErr lcError = Log_Error(m.loErr) =ErrorMsg(m.lcError) llPrinted = .f. endtry if m.llPrinted wait window "Re-Printing completed!" timeout 2 thisform.release() endif endif