Following on from the last post, here's a simple macro that uses the count property. Since the property will include totals for Explorer reports in the count, there is a test for the mode to adjust.
'* This macro requires an active PowerPlay report.
Option Explicit
Sub Main
Dim objPPRep As Object
Dim strErrorText As String
Dim ColumnCount As Integer
Dim RowCount As Integer
Dim test
On Error GoTo ErrorMes
Set objPPRep = GetObject(,"CognosPowerPlay.Report")
Test = objPPRep.ExplorerMode
ColumnCount = objPPRep.Columns.Count
RowCount = objPPRep.Rows.Count
If test = -1 then ColumnCount = ColumnCount -1
If test = -1 then RowCount = RowCount -1
MsgBox "The open report has " & ColumnCount & " columns and " & _
RowCount & " rows."
done:
Exit Sub
ErrorMes:
strErrorText = "The following error occurred at line " & Erl & "." & _
Chr$(13) & Chr$(13) & Chr$(9) & Err & " " & Error
If Err = 429 Then
MsgBox strErrorText & Chr$(13) & Chr$(13) & "Please ensure that " & _
"a PowerPlay report is active before running the macro."
Else
MsgBox strErrorText
End If
Resume done
End Sub
["] Veni, Vidi, Velcro. ["]