Skip to Content
0

Print Crystal Report (2013) from Word 2010 Macro

Nov 15, 2017 at 05:25 PM

24

avatar image
Former Member

Hello, I want to create a macro in Word 2010 that passes parameters and prints a Crystal Reports 2013 report (rpt file is local on the machine). I have searched and searched and have not been able to find documentation of the code I could use to call the Crystal Report from VBA. I tried this:

Sub Print_Patient_Draft_Report2()
'
' Print_Patient_Draft_Report2 Macro
'
'
Dim CR As New CRAXDRT.Application
Dim rep As CRAXDRT.Report
Set rep = crxApp.OpenReport("C:\TestReport\PatientDraftReport.rpt")
rep.ParameterFields(1).AddCurrentValue "*"
rep.ParameterFields(2).AddCurrentValue "*"
rep.ParameterFields(3).AddCurrentValue "*"
rep.ParameterFields(4).AddCurrentValue "*"
rep.ParameterFields(5).AddCurrentValue "*"
rep.ParameterFields(6).AddCurrentValue "PD-17-00111"
rep.ReadRecords
rep.PrintOut promptUser:=False, numberOfCopy:=1 ' promptUser:=True doesn't work
End Sub

But get a runtime error 424 on the OpenReport line.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Don Williams
Nov 15, 2017 at 05:27 PM
0

You are using the RDC which is no longer shipped or supported since CR XI R2.

We no longer have a SDK that can be used directly in Word. You could write one using the .NET SDK from here:

https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads

Don

Share
10 |10000 characters needed characters left characters exceeded