|
-
Jun 28th, 2006, 12:09 PM
#1
Thread Starter
New Member
Help Exporting to Excel via VB
I have a VB app that uses Crystal Reports to shoot out a report in XLS format. Works fine except for records that have no values in certain columns. For these records, it shifts the remaining columns to the left.
If I open the report in Crystal and export it through the Crystal app, this is not a problem. Only when I run the process through VB does this happen.
Below is the code in VB.
Is there any way to fix this, and if so, how?
Thanks for your help.
'Open the report
Set CrystalReport = CrystalApp.OpenReport(rptpath)
'Set all the options to export the report to a Rich Text Format file
Set CrystalExportOptions = CrystalReport.ExportOptions
DoEvents
CrystalReport.PaperOrientation = crLandscape
DoEvents
CrystalReport.BottomMargin = 0
DoEvents
CrystalReport.LeftMargin = 0
DoEvents
CrystalReport.TopMargin = 0
DoEvents
CrystalReport.RightMargin = 0
DoEvents
CrystalExportOptions.ExcelConstantColumnWidth
DoEvents
CrystalExportOptions.ExcelMaintainColumnAlignment = True
DoEvents
CrystalExportOptions.ExcelMaintainRelativeObjectPosition = True
DoEvents
CrystalExportOptions.ExcelMaintainColumnAlignment = True
DoEvents
CrystalExportOptions.FormatType = crEFTExcel80
DoEvents
CrystalExportOptions.ExcelPageBreaks = False
DoEvents
CrystalExportOptions.DestinationType = crEDTDiskFile
DoEvents
CrystalExportOptions.DiskFileName = sDestinationPath
'Export the report without prompting the user
DoEvents
CrystalReport.Export False
DoEvents
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
|