ActiveReport Method
Returns the active Report object for the Application
object.
Syntax
Application.ActiveReport
Applies To
Discussion
Use this method to gain control of the active report in the application. For example, when you open multiple reports, use this method to return the active Report object, without the need to specify the name of the Report object.
Return Type
Object
Example
This example adds a report to the Reports collection so that there are multiple reports open. The ActiveReport method sets the focus on the last report that you opened or added to the collection.
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 = objPPApp.ActiveReport
MsgBox "The name of the active report is " &objPPRep.Name
Set objPPRep = Nothing
Set objReports = Nothing
Set objPPApp = Nothing
End Sub