dmorand Posted September 18, 2008 Share Posted September 18, 2008 I'm trying to print a report to a printer automatically when a user runs my script. I know I need to use the PrintToPrinter method, but when I call it I get an error: "The requested action with this object has failed." Has anyone gotten the crystal functions to work with autoit? Dim $ReportName Dim $CRApp Dim $CrystalReport $ReportName = "C:\Transfer\Missing_Documents_ED_Encounters.rpt" $CRApp = ObjCreate("CrystalRuntime.Application.10") If $CRApp = 0 Then MsgBox(0, "Error", "Could not create CrystalRuntime Object") Exit EndIf $CrystalReport = $CRApp.OpenReport($ReportName) If $CrystalReport = 0 Then MsgBox(0, "Error", "Could not open report: " & $sReportName) Exit Else MsgBox(0,"Success","Report Opened") EndIf $CrystalReport.PrintToPrinter(1,False,0,0) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now