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

Problems with formatting when saving report as Excel

Status
Not open for further replies.

FirstTimeMacroHELP

Technical User
Jun 17, 2013
5
0
0
GB
Morning,
I am trying to automate a weekly report to save as an Excel file on Series 7 Version 4 but when I save it from the Macro it moves columns, merges data and generally changes things. If I run the same report manually and save it as .xls it seems fine, this is getting really irritating as I have to log on out of hours to run the report.
Coding as below

Dim ImpAppObject as Object
Dim ImpRepObject as Object
Dim XLSPubObject as Object
Sub Main()
Set ImpAppObject = CreateObject("Impromptu.Application")
ImpAppObject.OpenCatalog "\\csdpr15ap\codadir\Impromptu\codalive.cat", "All users"
Set ImpRepObject = ImpAppObject.OpenReport("\\csdpr15ap\codadir\Impromptu\Exchequer\ADR_Laser.imr","LASER|2014 / 05|C00000|C99999|*")
ImpRepObject.RetrieveAll
Set XLSPubObject = ImpRepObject.PublishExcel
XLSPubObject.Publish "\\cs\groups\public\EXTRA IMPROMPTU REPORTS\ADR_Laser.xls"
ImpRepObject.CloseReport
ImpAppObject.Quit
Set ImpRepObject = Nothing
Set ImpAppObject = Nothing
End Sub

Thanks :)
 
Are you publishing to Impromptu web?
If not, try using ExportExcelWithFormat command:

Code:
ImpRepObject.ExportExcelWithFormat "\\cs\groups\public\EXTRA IMPROMPTU REPORTS\ADR_Laser.xls"

Also, depending on the layout of the report (groupings/headings), try changing the Excel Version of the Report properties from Excel 2000 to Excel 2002 and higher.

soi là, soi carré
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top