Page 1 of 1

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

Posted: Thu Feb 18, 2016 5:59 am
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

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

Posted: Thu Feb 18, 2016 9:42 am
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?

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

Posted: Thu Feb 18, 2016 10:00 am
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.

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

Posted: Thu Feb 18, 2016 8:46 pm
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

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

Posted: Thu Feb 18, 2016 8:52 pm
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.

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

Posted: Fri Feb 26, 2016 9:11 am
by Luke Noah
Yeah Paulsimon , I was confused about that. I tried with Application.run and It was successful.

Thanks,
Luke