Results 1 to 2 of 2

Thread: Crystal to EXCEL

  1. #1

    Thread Starter
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Crystal to EXCEL

    I have Crystal Report Writer 85.. I want my vb6 app to run the report that will export the data to EXCEL.

    My questions are:

    Do I need this code?
    Report.SelectPrinter glbPrinterDriver, glbPrinterName, glbPrinterPort

    I know I need:
    Set Report = crxApplication.OpenReport("C:\AvedaXL.rpt", 1)
    Report.PrintfileType = 19 'EXCEL5
    Report.PrintFileName = "C:\Aveda.xls"
    Report.PrintOut False

    When the report is done, I need to have an EXCEL sheet created.

  2. #2
    Addicted Member
    Join Date
    Jan 2001
    Location
    MPLS
    Posts
    187
    Almost. You don't need the Report.SelectPrinter since you're only exporting, and don't use any of the print objects. Also if your exporting to excel I believe you have the wrong export code.

    You minimal code would be:

    Code:
    Set Report = crxApplication.OpenReport("C:\AvedaXL.rpt", 1) 
    Report.ExportOptions.FormatType = crEFTExcel80
    Report.ExportOptions.DiskFileName = "C:\Aveda.xls"
    Report.ExportOptions.DestinationType = crEDTDiskFile
    Report.Export False
    If your DB used in the report requires login, you'll also have to set the login info for each table like the following:

    Code:
    For Each crpTable In Report.Database.Tables
        crpTable.SetLogOnInfo "myhost", , "myusername", "mypassword"
    Next

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width