i'm new with TM1 and i try to get a auto connection in some sheets for TM1.
So i added in the Open Event a check to find out if the user already loaded the plugin, if not then the addon should be loaded.
After that i call the COnnection call from the dll, now you can select a server and press connect.
2 Issues at the moment:
1.) it loads the TM1 Ribbon Addon everytime, even if you already load it.
2.) the Ribbon control is after the connection still disabled like i have never connected to a server
My Open Event:
Code: Select all
Private Sub workbook_open()
Application.Calculation = xlCalculationManual
'load TM1 add-in if the TM1 menu do not exist
If Not (bCommandBarExists("TM&1")) Then
Workbooks.Open ("C:\Program Files\ibm\cognos\tm1_64\bin\tm1p.xla")
End If
'hide TM1 toolbars if not in correct team // add MAD to check users
On Error Resume Next
With Application
' .CommandBars("TM1 Servers").Visible = False
' .CommandBars("TM1 Developer").Visible = False
' .CommandBars("TM1 Spreading").Visible = False
' .CommandBars("TM1 Standard").Visible = False
End With
On Error GoTo 0
Application.Run ("NET_CONN")
'msg = Run("N_CONNECT", "spatpss023.at.dc.eb-grp.net", "Planung")
If msg <> "" Then
MsgBox msg
End If
Application.Run "TM1RECALC"
End Sub
------
Code: Select all
Function bCommandBarExists(sCmdBarName As String) As Boolean
Dim bCbExists As Boolean
Dim cb As CommandBar
bCbExists = False
For Each cb In Application.CommandBars
If cb.Name = sCmdBarName Then
bCbExists = True
Exit For
End If
Next
bCommandBarExists = bCbExists
End Function
Thanks for your Help
BR