VBA N_Connect

Post Reply
AmbPin
Regular Participant
Posts: 173
Joined: Sat Mar 20, 2010 3:03 pm
OLAP Product: TM1
Version: 9.5.2
Excel Version: 2007-10

VBA N_Connect

Post by AmbPin »

Hello,
Regarding the simple code extract below:-

Code: Select all

  Dim s As String
    
  s = Application.Run("N_CONNECT", sTM1Server, "UID", "PWD")
  If s = "" Then
    Debug.Print Application.Run("DimSiz", "TM1Server" & ":}Clients")
    Debug.Print Application.Run("DIMNM", "MyServer:}Clients", 1, "Alias")
    Debug.Print Application.Run("N_DISCONNECT")
  End If
This works fine the first time I run it, however the DimNM function returns blank on every subsequent run. Is this to be expected?
AmbPin
Regular Participant
Posts: 173
Joined: Sat Mar 20, 2010 3:03 pm
OLAP Product: TM1
Version: 9.5.2
Excel Version: 2007-10

Re: VBA N_Connect

Post by AmbPin »

Just added a call to TM1Refresh as shown below:-

Code: Select all

  Dim s As String
    
  s = Application.Run("N_CONNECT", sTM1Server, "UID", "PWD")
  If s = "" Then
    Application.Run "TM1Refresh"
    Debug.Print Application.Run("DimSiz", "TM1Server" & ":}Clients")
    Debug.Print Application.Run("DIMNM", "MyServer:}Clients", 1, "Alias")
    Debug.Print Application.Run("N_DISCONNECT")
  End If
Which now makes it work OK. Is the the best way to do this?
Post Reply