|
-
Jan 22nd, 2003, 11:45 AM
#1
Thread Starter
PowerPoster
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.
-
Jan 23rd, 2003, 04:24 PM
#2
Addicted Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|