PdcReport.PrintToPrinter
Declaration
PrintToPrinter(Copies as long,Printer as String) as Boolean
Description
Notes
This method prints the reports immediately to the printer. The parameter copies is the number of prints. With the printername parameter the script can specify a printer.
Code example
This example code opens a report with ID 336 and print it on the specified printer.
dim objReports
dim objReport
dim objPrinters
dim intCnt
dim strPrinterNames
dim strPrinterName
set objReports = pdc.Reports
set objPrinters = objReports.PrinterNames
for intCnt = 0 to objPrinters.Count - 1
strPrinterNames = strPrinterNames & objPrinters(intCnt) & vbCrLf
if InStr(UCase(objPrinters(intCnt)), "PARTOFPRINTERNAME") > 0 then
strPrinterName = objPrinters(intCnt)
end if
next
if Trim(strPrinterName) <> "" then
set objReport = objReports.Open(336)
if objReport.AddFilter("DO_CALC", "DO_ORDNR='00464'") then
objReport.PrintToPrinter 1, strPrinterName
else
msgbox "This is not a correct filter | " & objReport.ErrorMessage
end if
else
msgbox strPrinterNames
end if
Availability
Available since February 2011 (from version 4.2).