PatMcLaughlin
Programmer
I am using Visual Foxprow9 and attempting to print a report generated in Crystal Reports 9 to a specific (chosen at runtime) printer.
Defined in prior code:
lcReport = report name
lcPName = printer to print report to (These will be available in the Printers defined and attached to the computer)
tnCopies = the number of copies to print
loCrystal=CreateObject("CrystalRuntime.Application")
loReport=loCrystal.OpenReport("c:\vfp\ka\CrystalReports\" + lcReport + ".rpt",1)
loReport.SetPrinter((lcPName), (lcPName), "")
loReport.PaperOrientation = 1
loReport.DisplayProgressDialog = False
loReport.PrintOut(False, (tnCopies))
When the 'SetPrinter' line runs, I get an error msg ("ole error code 0x80020006: unknown name")
I have also tried loReport.SelectPrinter without success.
If I eliminate this line, it will print without error to the default printer. Any Ideas how I can select a printer?
Defined in prior code:
lcReport = report name
lcPName = printer to print report to (These will be available in the Printers defined and attached to the computer)
tnCopies = the number of copies to print
loCrystal=CreateObject("CrystalRuntime.Application")
loReport=loCrystal.OpenReport("c:\vfp\ka\CrystalReports\" + lcReport + ".rpt",1)
loReport.SetPrinter((lcPName), (lcPName), "")
loReport.PaperOrientation = 1
loReport.DisplayProgressDialog = False
loReport.PrintOut(False, (tnCopies))
When the 'SetPrinter' line runs, I get an error msg ("ole error code 0x80020006: unknown name")
I have also tried loReport.SelectPrinter without success.
If I eliminate this line, it will print without error to the default printer. Any Ideas how I can select a printer?