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!

Crystal 9 export to Excel

Status
Not open for further replies.

BCarol

Technical User
Feb 14, 2002
23
AU
I can export to Excel from the Crystal Viewer window, and I can also export directly to Excel using some code that I wrote.

However, if I try to do both in the same session, the second one gives an error. I have to close my application. When I run it again, it works fine.

Any suggestions on how to refresh Crystal so it will do both exports without a software restart between them?
 
Hi,
What error and where are you running this code?



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Hi

The error when I run my code is:

MESSAGE: OLE IDispatch exception code 0 from Crystal Reports ActiveX Designer: Failed to export the report.
Error formatting the page...

Note: Only get this error if exported from Preview first.
If exported report first, it works fine without error.

I am running the code as a FoxPro program (but I don't think that should influence it).

I am exporting to Microsoft Excel 97.

ALSO:

If I run the export first (successfully), and then preview the report, and then from the preview window export to Excel, it causes a fatal error in my application.

So just exporting to Excel by the one mechanism causes the other to fail. If I stick with using just the one method i.e. export reports directly or preview and then export, I can do it as many times as I like successfully.

Any ideas?


 
More information: I tried this with a simple report with just Details. Same problem.

These are the lines in my export code:

oExport.DestinationType = 1 && Disk File
oExport.FormatType = 29 && Excel 80
oExport.ExcelAreaType = 4 && crDetail
oExport.ExcelTabHasColumnHeadings = .T.
oExport.ExcelPageBreaks = .F.
oExport.ExcelExportAllPages = .T.

Are there other setting I should use that may help?



 
Can anyone help?

Exporting to Excel from the Preview window and then from code causes some interference. Each export works independently, but doing both in the same session causes problems.

Any suggestions please?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top