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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cognos OLE Automation In Excel VBA

Status
Not open for further replies.

polljoh

Programmer
Apr 8, 2003
6
0
0
GB
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


 
hmmmm.. a work around: you can use the minimize method for the report object. Is this an option?

Christenhusz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top