SHARE
TWEET

CrystalReports Export Excel

a guest May 2nd, 2014 135 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Dim oApp, oRpt  
  2. vFilenameReport = UCase("C:\Customer Folders\Report Location\CrystalReport.rpt")
  3. vFilenameExport = UCase("C:\Customer Folders\Output Destination\CrystalExport.xls")
  4.   Set oApp =CreateObject("CrystalRuntime.Application")  
  5.   Set oRpt = oApp.OpenReport(vFilenameReport, 1)  
  6.   oRpt.DisplayProgressDialog = False  
  7.   oRpt.MorePrintEngineErrorMessages = False  
  8.   oRpt.EnableParameterPrompting = False  
  9.   oRpt.DiscardSavedData
  10.   Set dbproperties = oRpt.Database.Tables.Item(1).ConnectionProperties
  11.   dbproperties("User ID") = "DATABASE_USER"
  12.   dbproperties("Password") = "DATABASE_PASS"  
  13.   oRpt.ExportOptions.DiskFileName = vFilenameExport  
  14.   oRpt.ExportOptions.FormatType = 36                  '36=>Excel  
  15.  oRpt.ExportOptions.DestinationType = 1              '1=>filesystem  
  16.   oRpt.ExportOptions.ExcelAreaType = 4                            '4=>detail records determine column width
  17.  oRpt.ExportOptions.ExcelUseConstantColumnWidth = False  
  18.   oRpt.ExportOptions.ExcelUseWorksheetFunctions = False
  19.   oRpt.ExportOptions.ExcelExportImagesInDataOnly = False
  20.   oRpt.ExportOptions.ExcelMaintainRelativeObjectPosition = False
  21.   oRpt.ExportOptions.ExcelChopPageHeader = True
  22.   oRpt.ExportOptions.ExcelUseFormatInDataOnly = True
  23.   oRpt.ExportOptions.ExcelExportAllPages = True  
  24.   oRpt.ExportOptions.ExcelPageBreaks = False  
  25.   oRpt.Export(False)
RAW Paste Data
Top