How to connect to TM1 Using VBA and add the DLL'S?

Post Reply
Luke Noah
Posts: 4
Joined: Tue Feb 16, 2016 12:52 pm
OLAP Product: IBM Cognos TM1
Version: 10.2.2
Excel Version: 2013

How to connect to TM1 Using VBA and add the DLL'S?

Post by Luke Noah »

Please Can any one help me in connecting to the TM1 using VBA and also how to set the path variable and load the dll's?

Thanks,
Luke
David Usherwood
Site Admin
Posts: 1458
Joined: Wed May 28, 2008 9:09 am

Re: How to connect to TM1 Using VBA and add the DLL'S?

Post by David Usherwood »

Err....
If you are using VBA (in Excel) rather than VB, just load the Perspectives XLA, which will pull all the DLLs in, and use N_Connect.
Or have I missed something?
Alan Kirk
Site Admin
Posts: 6647
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: How to connect to TM1 Using VBA and add the DLL'S?

Post by Alan Kirk »

Luke Noah wrote:Please Can any one help me in connecting to the TM1 using VBA and also how to set the path variable and load the dll's?

Thanks,
Luke
What David said.

You may be confusing two different methods of automation. With the classic API you need to set the Path environment variable to point to the libraries. (This is discussed in the API manual. My irritation that the installation program does not automatically update the path will be found scattered liberally around this Forum.) There is no need to load the DLLs to use the APIs in VBA.

The other method is to use macro functions, including the N_Connect one that David mentioned, details of which will be found in the Reference Guide. (A link to which is here.)

The classic API is an ugly beast of a thing and should always be your last resort, particularly in VBA where you have the whole array of both macro and worksheet functions at your disposal via the Perspectives add-in. These are all much less mind-bending and far easier to work with than the API is. They can't do everything that the API can do, but for VBA purposes they are usually more than enough.
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
User avatar
paulsimon
MVP
Posts: 808
Joined: Sat Sep 03, 2011 11:10 pm
OLAP Product: TM1
Version: PA 2.0.5
Excel Version: 2016
Contact:

Re: How to connect to TM1 Using VBA and add the DLL'S?

Post by paulsimon »

Hi

One thing that may be confusing you is that the Macro functions are still described in Excel 4 format
eg N_CONNECT( server, user, password)

When using this in VBA you need

Application.run "N_CONNECT", sServer, sUser, sPassword

Basically the name of the Macro is the first argument to the run function.

Regards

Paul Simon
Alan Kirk
Site Admin
Posts: 6647
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: How to connect to TM1 Using VBA and add the DLL'S?

Post by Alan Kirk »

paulsimon wrote: One thing that may be confusing you is that the Macro functions are still described in Excel 4 format
eg N_CONNECT( server, user, password)
True. But to be fair to Iboglix (and when it comes to documentation, that can be really, really hard to do), that is pretty well explained under the "Accessing Macro Functions from VBA Modules" topic that sits near the top of the Reference Guide link that I gave above.
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
Luke Noah
Posts: 4
Joined: Tue Feb 16, 2016 12:52 pm
OLAP Product: IBM Cognos TM1
Version: 10.2.2
Excel Version: 2013

Re: How to connect to TM1 Using VBA and add the DLL'S?

Post by Luke Noah »

Yeah Paulsimon , I was confused about that. I tried with Application.run and It was successful.

Thanks,
Luke
Post Reply