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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB- Crystal 8.5 export to Excel need Column Headers

Status
Not open for further replies.

CJwater

IS-IT--Management
Mar 26, 2008
34
US
Hi,

I'm Exporting a crystal report to Excel and I need to include the column headers.

The follow code does the report export but I don't get any header (It does gives me all report totals). Anyone have an idea what I'm doing wrong? missing?


Set report = appl.OpenReport("\\cr\\Rpt_WeeklySales.rpt")

report.ParameterFields.Item(1).AddCurrentValue StartDt
report.ParameterFields.Item(2).AddCurrentValue EndDt
report.ParameterFields.Item(3).AddCurrentValue mfgBrand
report.ExportOptions.DestinationType = crEDTDiskFile
report.ExportOptions.ExcelTabHasColumnHeadings = True
report.ExportOptions.FormatType = crEFTExcel80

report.ExportOptions.DiskFileName = "\\serverr\Sales(Excel) _" & Format(Date, "yyyymmdd") & ".xls"

report.Export False

Any thoughts on this?

Thanks
CJ
 


Hi,

Thats a CR question, I believe, not an Excel VBA question.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
I'm writing VB code to execute, the code I posted is VB.
 



This is Visual Basic for Applications(Microsoft) not CR.

Your code might be VB for CR, be there would be very few knowledgable of the CR Object Model in this forum.

If it were me, I'd BYPASS CR and query straight from the source data right into Excel. But that's me.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Thanks for the advice I've moved it over to Crystal Data access.

CJ
 
Figured it out ...

here's the code to include the headers just in case someone else needs it...

report.ParameterFields.Item(1).AddCurrentValue StartDt
report.ParameterFields.Item(2).AddCurrentValue EndDt
report.ParameterFields.Item(3).AddCurrentValue mfgBrand
report.ExportOptions.DestinationType = crEDTDiskFile
report.ExportOptions.FormatType = crEFTExcel80


I had to remove this code to get headers to show up...
report.ExportOptions.ExcelTabHasColumnHeadings = True

CJ
 



Thank you for supplying the operative CR VBA code, referencing the appropriate CR Object Model properties and methods.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top