VB中的水晶报表如何实现导出?
报表显示正常,我想利用下面语句导出:DimexportOptsAsCRAXDRT.ExportOptionsSetexportOpts=Report.ExportOpti...
报表显示正常,我想利用下面语句导出:
Dim exportOpts As CRAXDRT.ExportOptions
Set exportOpts = Report.ExportOptions
exportOpts.DestinationType = crEDTDiskFile
exportOpts.DiskFileName = "D:\text.xls"
exportOpts.FormatType = crEFTExcel97 'Excel97格式
exportOpts.ExcelExportAllPages = True '导出所有页码
Report.Export (False)
导出对话框出现了,但出中断出错:实时错误2147189176......登陆失败,...数据库不是一个有效路径.
我用的是VB6.0 展开
Dim exportOpts As CRAXDRT.ExportOptions
Set exportOpts = Report.ExportOptions
exportOpts.DestinationType = crEDTDiskFile
exportOpts.DiskFileName = "D:\text.xls"
exportOpts.FormatType = crEFTExcel97 'Excel97格式
exportOpts.ExcelExportAllPages = True '导出所有页码
Report.Export (False)
导出对话框出现了,但出中断出错:实时错误2147189176......登陆失败,...数据库不是一个有效路径.
我用的是VB6.0 展开
1个回答
展开全部
Dim tempxlApp As New Excel.Application
Dim tempxlWorkbook As New Excel.Workbook
Dim tempxlSheet As New Excel.Worksheet
Set tempxlWorkbook = tempxlApp.Workbooks.Open("e:\test.xls")
tempxlApp.Visible = True
tempxlApp.DisplayAlerts = False
set tempxlSheet = tempxlWorkbook.Worksheets("sheet1")
'写入Excel
tempxlSheet.Range("A1").CopyFromRecordset tempRS
tempRS.Close
tempRS 为记录集
希望对你有所帮助!!!
Dim tempxlWorkbook As New Excel.Workbook
Dim tempxlSheet As New Excel.Worksheet
Set tempxlWorkbook = tempxlApp.Workbooks.Open("e:\test.xls")
tempxlApp.Visible = True
tempxlApp.DisplayAlerts = False
set tempxlSheet = tempxlWorkbook.Worksheets("sheet1")
'写入Excel
tempxlSheet.Range("A1").CopyFromRecordset tempRS
tempRS.Close
tempRS 为记录集
希望对你有所帮助!!!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询