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

Cognos Impromptu 7.4 - Excel Report

Status
Not open for further replies.

jp92506

MIS
Apr 9, 2008
4
US
I have a report that I need to run off of the scheduler and needs to be saved as an Excel file. I have created the following macro but it does seem to work. It will run with no errors but no data is being populated. Please advise as to why this may not be working.

Thanks You....
Joe

*******************************************************

Dim ImpAppObject as Object
Dim ImpRepObject as Object

Sub Main()

Set ImpAppObject = CreateObject("Impromptu.Application")
Set ImpAppObject = CreateObject("Impromptu.Application")
ImpAppObject.OpenCatalog "U:\Impromptu\Joe's UtiliNaviCatalog.cat", "SBDO", "qrep", "JOE", "PASSWORD"
Set ImpRepObject = ImpAppObject.OpenReport("U:\Impromptu\WUWorkOrders\WOTest040808.imr")
ImpRepObject.RetrieveAll
ExportAs=True
ExportType = "xls"
ExportFileName = "U:\Impromptu\ScheduledReports\WUTest.xls"
ImpRepObject.CloseReport
ImpAppObject.Quit
Set ImpRepObject = Nothing
Set ImpAppObject = Nothing

End Sub
 
Joe,
You're missing a command to save the file.
Add in the line
objImpRep.ExportExcelWithFormat ExportFileName
to your code before closing the report.

The lines
ExportAs=True
ExportType = "xls"
appear to be unnecessary.

Code:
Sub Main()

Set ImpAppObject = CreateObject("Impromptu.Application")
Set ImpAppObject = CreateObject("Impromptu.Application")
ImpAppObject.OpenCatalog "U:\Impromptu\Joe's UtiliNaviCatalog.cat", "SBDO", "qrep", "JOE", "PASSWORD"
Set ImpRepObject = ImpAppObject.OpenReport("U:\Impromptu\WUWorkOrders\WOTest040808.imr")
ImpRepObject.RetrieveAll
ExportAs=True
ExportType = "xls"
ExportFileName = "U:\Impromptu\ScheduledReports\WUTest.xls"
[b]objImpRep.ExportExcelWithFormat ExportFileName[/b]
ImpRepObject.CloseReport
ImpAppObject.Quit
Set ImpRepObject = Nothing
Set ImpAppObject = Nothing
  
End Sub

soi la, soi carré
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top