Thursday, March 29, 2012

Directly print to Printer

Hi,
I have a VB Application with Crystal Report 8. If I click the print button in VB, I dont want to show the Crystal Report. I want to print the contents of the report directly to the Printer without showing the report. Is there a way to do this?
Thanks in advance
MadhivananFrom memory, so.........please forgive any errors from failed memory......:-))

assumes using CR active x control:

Dim objPrintApp As CRAXDRT.Application
Dim objReport As CRAXDRT.Report

Set objPrintApp = New CRAXDRT.Application
Set objReport = objPrintApp.OpenReport(strReportSourcePath & strSourceFile)
objPrintApp.LogOnServerEx "pdsodbc.dll", "database", "database", "user", "pwd"

' set PromptUser to False, NumberOfCopies to value >=1
' all parameters in brackets are optional.
objReport.Printout [PromptUser], [NumberOfCopies], [Collated], [StartPageNumber], [StopPageNumber]

dave|||Thanks springsoft. I think this is for CR9 but what is the code for CR8?.

Madhivanan

No comments:

Post a Comment