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!

Macro to print Powerplay report with fit to page

Status
Not open for further replies.

jvaneert

MIS
Sep 10, 2002
18
NL
Hi All,

Please help me, i want to have a macro that prints a powerplay report with the option fit to page.
Does someone have some macro code which i could use>?
Many thanks in advance.

Best regards,

Jules
 
Does FitToPage not work for you? See the macro help, but basically it's "objRepPrt.FitToPage = True".



soi la, soi carré
 
Hi DrLex.

I am a rookie with macro's so i even do not know what the macro should contain.
Could you gimme a example of something?
Thanks

Best regards,

Jules
 
Jules,
sure - here's the example straight out of the macro help (all rights reserved, etc)
This example sets the FitToPage property to True and prints the first display of the active report (ie report already open) - to change it to opening one, substitute these lines:
Set objPPRep = CreateObject("CognosPowerPlay.Report")
objPPRep.open "C:\Views\MyPPreport.ppr".
for
Set objPPRep = GetObject(,"CognosPowerPlay.Report")

Code:
Sub Main()
   Dim objPPRep as Object
   Dim objRepPrt as Object
   Set objPPRep = GetObject(,"CognosPowerPlay.Report")
   Set objRepPrt = objPPRep.Print()
   With objRepPrt
      .PrintAllCharts = False
      .SetListOfRowsToPrint objPPrep.Rows
      .SetListOfLayersToPrint objPPRep.Layers
      .SetChartToPrint objPPRep.Graphs.Item(1)
      .IncludeLegend = False
      .ChartTitleOnAllPages = True
      .SummariesOnAllPages = True
      .AxisOnAllPages = True
      .Collate = True
      .Copies = 1
      .FitToPage = True
      .PrintOut
   End With
   Set objRepPrt = Nothing
   Set objPPRep = Nothing

End Sub

soi la, soi carré
 
Hi DrLex,

Thanks for your macro,
it really helped me!
 
Jules, you're welcome.
If you're a rookie, have a look at the pdf that is installed with the cognos products - should be in the documentation folder - "pp_mac.pdf", which is the best place to start. If you have Visual Basic experience, it should be un morceau de gateau [smile]

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

Part and Inventory Search

Sponsor

Back
Top