水晶报表导出pdf
请先看一下这段代码:
Dim Report As New CrystalReport_user
Dim wjfilesys As FileSystemObject 'FSO 对象,用于文件操作
Dim capp As New CRAXDDRT.Application '报表集合对象
Dim carp As New CRAXDRT.Report '报表集合中的报表对象
Dim carsubp As New CRAXDRT.Report '报表集合对象中的子报表对象
Dim Pic2 As OLEObject '报表对象中的Ole对象
Dim mytxt As CRAXDRT.TextObject '报表对象中的Textbox对
Private Sub Cmd_Click()
Dim myExportFile As String
myExportFile = App.Path + "\temp.pdf "
If wjfilesys.FileExists(myExportFile) Then
wjfilesys.DeleteFile (myExportFile)
End If
Report.ExportOptions.DiskFileName = myExportFile
Report.ExportOptions.FormatType = crEFTPortableDocFormat
Report.ExportOptions.DestinationType = crEDTDiskFile
Report.ExportOptions.PDFExportAllPages = True
Report.Export (False)
End Sub
当程序执行到 If wjfilesys.FileExists(myExportFile) Then 时,
报错:“实时错误‘91’,对象变量或with 块变量未设置”
请问是为什么?
请大家帮忙!!!!
[解决办法]
Dim wjfilesys As new FileSystemObject 'FSO 对象,用于文件操作