I have written a class in Excel to wrap Poweplay API functionality. I have one method which instantiates an instance of a powerplay report. During testing the visible property was always set to True. Subsequent methods of the class manipulate a Report object which uses the GetObject function to get an instance of the open report.
All worked well until I changed the Visible property to False. Now any method call that uses GetObject Fails with the error message :
ActiveX can't create component.
I tested to see if an instance of powerplay was running in memory if instantiated using the CreateObject function and setting its visible property to false and found that it wasn't. The instance in memory seems to only last for the lifetime of the method call, hence any subsequent calls using GetObject fail.
I would not expect this to happen and for the application I am developing need powerplay to operate invisibly.
I attach sample code :
Sub Main ()
With objCognos
.NewReport False
.ChangeMeasure "Billed Sales £"
End With
End Sub
Class Code
Public Sub NewReport(blnVisible As Boolean)
Set objPPRep = CreateObject("CognosPowerPlay.Report"
With objPPRep
.New strPPCubePath, 1
.ExplorerMode = False
If blnVisible = True Then
.Visible = True
End If
End With
Set objPPRep = Nothing
End Sub
Public Sub ChangeMeasure(strMeasure As String)
Set objPPRep = GetObject(, "CognosPowerPlay.Report"
Set objPPDimension = objPPRep.DimensionLine.Item("Measures"
objPPDimension.ChangeToTop
objPPDimension.Change strMeasure
Set objPPRep = Nothing
Set objPPDimension = Nothing
End Sub
Any help would be greatly appreciated.
Regards
JOHN
All worked well until I changed the Visible property to False. Now any method call that uses GetObject Fails with the error message :
ActiveX can't create component.
I tested to see if an instance of powerplay was running in memory if instantiated using the CreateObject function and setting its visible property to false and found that it wasn't. The instance in memory seems to only last for the lifetime of the method call, hence any subsequent calls using GetObject fail.
I would not expect this to happen and for the application I am developing need powerplay to operate invisibly.
I attach sample code :
Sub Main ()
With objCognos
.NewReport False
.ChangeMeasure "Billed Sales £"
End With
End Sub
Class Code
Public Sub NewReport(blnVisible As Boolean)
Set objPPRep = CreateObject("CognosPowerPlay.Report"
With objPPRep
.New strPPCubePath, 1
.ExplorerMode = False
If blnVisible = True Then
.Visible = True
End If
End With
Set objPPRep = Nothing
End Sub
Public Sub ChangeMeasure(strMeasure As String)
Set objPPRep = GetObject(, "CognosPowerPlay.Report"
Set objPPDimension = objPPRep.DimensionLine.Item("Measures"
objPPDimension.ChangeToTop
objPPDimension.Change strMeasure
Set objPPRep = Nothing
Set objPPDimension = Nothing
End Sub
Any help would be greatly appreciated.
Regards
JOHN