williey
Technical User
- Jan 21, 2004
- 242
I have automate a set of Crystal reports using VB script. Now I need to export some reports to Excel. But I run into the error of "crEFTExcel80" is being a valid property or method. BTW, I'm running CR 8.5.
Here is a snippet of my code..
------------------------------------------
There are 10 kinds of people in this world. One that understands binary and the other one that does not.
Here is a snippet of my code..
Code:
' Declare variables
Dim oRptApp, oRpt, oRptParam1
Dim oRptExportOptions
' Set the object for the App
Set oRptApp = CreateObject("CrystalRuntime.Application")
' ### Set the object for the 1C2A Risk Weighting Report
Set oRpt = oRptApp.OpenReport(INPUT_PATH & IN_FILE31, 1)
' Set the first parameter
Set oRptParam1 = oRpt.ParameterFields.Item(1)
' Clear the first parameter value
oRptParam1.ClearCurrentValueAndRange
' Set the value of the first param
oRptParam1.AddCurrentValue CDate(endDate)
' Set export options
Set oRptExportOptions = oRpt.ExportOptions
oRptExportOptions.FormatType = oRpt.crEFTExcel80
oRptExportOptions.DestinationType = crEDTDiskFile
oRptExportOptions.DiskFileName = "C:\test.xls"
'Export the report without prompting the user
oRpt.Export False
------------------------------------------
There are 10 kinds of people in this world. One that understands binary and the other one that does not.