Add Method (Reports)
Adds a Report object to the Reports collection.
Syntax
Reports.Add MDCName
Applies To
Discussion
The Add method opens an existing report or cube and adds it to the Reports collection.
When you use the Add method for the Reports collection, you must capture the new Report object or it will terminate. For example, you must use the following to capture the new report created from the outdoors.mdc using the object, objPPRep1:
Set objPPRep1 = objPPApp.Reports.Add("c:\cognos\outdoors.mdc") Using
objPPApp.Reports.Add(c:\cognos\outdoors.mdc") terminates the report.
| Parameters |
Description |
|---|---|
| MDCName |
Required. Specifies the name of the MDC (cube) to be opened. Type: String |
Return Type
Object
Example
This example adds an existing report to the Reports collection and makes it visible in the active instance of IBM® Cognos® PowerPlay®.
Sub Main() Dim objPPRep As Object Dim objPPApp As Object Dim objReports As Object Set objPPApp = GetObject(, "CognosPowerPlay.Application") Set objReports = objPPApp.Reports Set objPPRep = objReports.Add("C:\Cubes and Reports\"
& _ "Sample1.ppx") objPPRep.Visible = True MsgBox "There are " & objReports.Count & "
reports open." Set objPPRep = Nothing Set objReports = Nothing Set objPPApp = Nothing End Sub