Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CR 8 to Office 2000 via VB 6 2

Status
Not open for further replies.
Using the RDC component you can open the report inside of VB6 and then export it to whatever at runtime. Use the project/add crystalreport on the menu and add your report. Set the database connection for the report within VB and then you can export it. Without getting into all the rest I'll just give you the syntax for exporting the report once you've created it in VB and set up the db connection. The export syntax is...

Dim strFilename As String
strFilename = "C:/My Documents/test.xls"

With CrystalReport1
.ExportOptions.DestinationType = crEDTDiskFile
.ExportOptions.FormatType = crEFTExcel80
.ExportOptions.DiskFileName = strFilename
.Export (False)
End With

Notes:
CrystalReport1 is the name you gave the crystal report imported in VB6. By default it's crystalreport1 but you can change it.

crEFTExcel80 is the format for excel 8. You can choose which you want using the microsoft intelichoice options.

strFileName is whatever you want the file to be named.

Good Luck.
CrystalVisualBOracle :)
 
No problem. It's my pleasure.

I should probably also tell you that I just completed developing an application where we planned to export a report to both Word and Excel so that users could choose which ever they wanted. BUT.... we only went with exporting to excel. The reason for this is that Crystal Reports does not support it's report format outside of .rpt files. What that means is that the reports look funny when exported. You have to alter the report over and over and then export it to see how it's going to appear. My trouble was that while I could come close to making it look nice in Excel 8, the only word format that would work was .rtf (Rich Text Format). That's fine except that whenever I made a change to the report so it would look better in Excel, the report would look HORRIBLE in .rtf format. So in the end we had to pick one and go with it. Maybe you won't have that problem but I thought you should have fair warning of it.

Enjoy your project!

CrystaVisualBOracle :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top