SHARE
TWEET

export crystal report to comma separated value

a guest May 30th, 2014 170 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Dim oApp, oRpt  
  2. vFilenameReport = UCase("C:\Customer Folders\Folder\Report.rpt")
  3. vFilenameExport = UCase("C:\Customer Folders\Folder\Report_Output.csv")
  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") = "XXXXX"
  12.   dbproperties("Password") = "XXXXX"  
  13.   oRpt.ExportOptions.DiskFileName = vFilenameExport  
  14.   oRpt.ExportOptions.FormatType = 5                  '5=>CSV  
  15.  oRpt.ExportOptions.DestinationType = 1              '1=>filesystem  
  16.  oRpt.ExportOptions.CharStringDelimiter = ""
  17.   oRpt.ExportOptions.CharFieldDelimiter = ","
  18.   oRpt.ExportOptions.UseReportDateFormat = true
  19.   oRpt.ExportOptions.UseReportNumberFormat = true
  20.   oRpt.Export(False)
RAW Paste Data
Top