Connecting with Integrated Login using VBA
Posted: Wed Jul 19, 2017 2:16 pm
Hi all - I've been tasked with creating a excel report that connects to our TM1 production server that uses Integrated Login security. On development I was able to use the N_CONNECT function because we have a lower security. However for production I'm using the following code which runs but it doesn't connect to the server.
Does anyone have any ideas why my code isn't connecting?
Thanks,
Steve
Code: Select all
Declare Function TM1SystemServerConnectIntegratedLogin Lib "tm1api.dll" (ByVal hPool As Long, ByVal vServerName As Long) As Long
Declare Function TM1SystemOpen Lib "tm1api.dll" () As Long
Declare Function TM1ValPoolCreate Lib "tm1api.dll" (ByVal hUser As Long) As Long
Declare Function TM1ValIndex Lib "tm1api.dll" (ByVal hPool As Long, ByVal InitIndex As Long) As Long
Declare Function TM1ValString Lib "tm1api.dll" (ByVal hPool As Long, ByVal InitString As String, ByVal MaxSize As Long) As Long
Declare Sub TM1SystemAdminHostSet Lib "tm1api.dll" (ByVal hUser As Long, ByVal AdminHosts As String)
Declare Sub TM1APIInitialize Lib "tm1api.dll" ()
Sub TM1_Connect()
Dim vServer As Long
Dim sServerName As String
Dim pPoolHandle As Long
Dim vServerName, vStringLength As Long
Dim hUser As Long
sServerName = "TDPlan_Prod"
hUser = TM1SystemOpen()
pPoolHandle = TM1ValPoolCreate(hUser)
vStringLength = TM1ValIndex(pPoolHandle, 11)
vServerName = TM1ValString(pPoolHandle, sServerName, vStringLength)
vServer = TM1SystemServerConnectIntegratedLogin(pPoolHandle, vServerName)
End Sub
Thanks,
Steve