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!

Saving Powerplay report as XLS 1

Status
Not open for further replies.

atomictortoise

Programmer
Aug 9, 2001
9
GB
Hi

Has anyone got a macro script example of how to save a.ppx file as an Excel spreadsheet? I see lots of examples of saving .imrs but not .ppx.

Any help much appreciated
 
Sure; this is what I use on 7.4 (and have used since 7.0).

Code:
   ...
   Dim objPPRep as Object 
   Set objPPRep = CreateObject("CognosPowerPlay.Report")
   objPPRep.open "C:\PP_Reports\PP_Report_name.ppx"
   objPPRep.SaveAs "C:\XL_Reports\PP_Report.xls",4
   objPPRep.Close
   Set objPPRep = Nothing
   ...

It's also pretty trivial to publish as html or pdf:

Code:
   ...
   Dim objPDF as object
   Dim objPPRep as Object 
   Set objPPRep = CreateObject("CognosPowerPlay.Report")
   objPPRep.open "C:\PP_Reports\PP_Report_name.ppx"
   objPPRep.Publish "C:\html"    'this is a folder path
   Set objPDF = objPPRep.PDFFile_( "C:\Reports\PP_Report.pdf", True )
   With objPDF
      .SaveEntireReport = True
      .SetListOfLayersToSave objPPRep.Layers
      .SetListOfRowsToSave objPPRep.Rows
   End With
   objPDF.Save
      objPPRep.SaveAs "C:\XL_Reports\PP_Report.xls",4
   objPPRep.Close
   Set objPPRep = Nothing
   ...
(Requires folder "C:\html")

soi là, soi carré
 
You're welcome.

I notice that there is an extraneous underscore in the second code snippet

objPPRep.PDFFile_( "C:\Reports\PP_Report.pdf", True )

should be

objPPRep.PDFFile( "C:\Reports\PP_Report.pdf", True )

The wrap-around in the submission window looked to have added a line break, so I was trying to indicate a continuation.

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

Part and Inventory Search

Sponsor

Back
Top