Page 1 of 1

Running TM1 process from VBA

Posted: Tue Jan 20, 2015 4:37 pm
by Jayme1
Hello everyone

is there a simple bit of code to run a TI process from Excel? is this all the code i need?

ExcecuteProcess(sServer, sProcess)


Thanks
jaimie

Re: Running TM1 process from VBA

Posted: Tue Jan 20, 2015 6:09 pm
by lotsaram
No. It isn't that simple by half as you have to declare a whole lot of API stuff but you can just copy / paste this so it isn't that hard either. Pretty sure TM1 Tools available from here has that in it.

Re: Running TM1 process from VBA

Posted: Tue Jan 20, 2015 7:08 pm
by declanr
Does it have to be from VBA or would an action button suffice?

Re: Running TM1 process from VBA

Posted: Tue Jan 20, 2015 7:39 pm
by Alan Kirk
Jayme1 wrote:
is there a simple bit of code to run a TI process from Excel? is this all the code i need?

ExcecuteProcess(sServer, sProcess)
Lotsaram is correct; TM1 Tools (which can be downloaded from here) has a wrapper around the API functions so that you can do a simple one line call, including passing parameters. The method is explained in the documentation.

But Declan is also correct; the need to do this has largely (though not entirely) been superseded by action buttons.

Re: Running TM1 process from VBA

Posted: Thu Jan 22, 2015 10:12 am
by Jayme1
Thanks a lot everyone for your help, I have now copied across the VBA needed to run a process. this all works fine on my machine, but on other it comes up with errors as they need a 64 bit machine to run the process. Bit of a shame as it was all working fine for me, any ideas?

Just on one final note, as i like to make things simple but i assume the answer is no:

Can you call an action button from vba? such as actionbutton.click? I have code that needs to run before and after some VBA. This would be neater than running the VBA AVI code (that only works on 64bit).

Thanks again

Jaimie

Re: Running TM1 process from VBA

Posted: Thu Jan 22, 2015 6:18 pm
by Wim Gielis
Jayme1 wrote:Can you call an action button from vba? such as actionbutton.click? I have code that needs to run before and after some VBA. This would be neater than running the VBA AVI code (that only works on 64bit).
Not directly, AFAIK. But you can use VBA to read the TI process name attached to the action button. Then run that one with TM1Runti.exe or TM1 Tools coding.

Re: Running TM1 process from VBA

Posted: Thu Jan 22, 2015 6:26 pm
by Alan Kirk
Jayme1 wrote: This would be neater than running the VBA AVI code (that only works on 64bit).
It does who in the what now?

I assure you that it doesn't only work on 64 bit. Traditionally the TM1 Excel client has been 32 bit only, intended to run under 32 bit Excel. It was only with version 10.2.2 that a 64 bit add-in was provided for 64 bit Excel. I don't have (or want, for the foreseeable future) 64 bit office so I haven't tested either VBA code or even TM1 Tools on that (you can't install 32 and 64 bit office side by side, though at some point I'll create a VM for it), but I can assure you that the VB API does work in a 32 bit environment and has done for literally decades now. If you're getting errors, something else is going on, but without knowing full details of the error it would be impossible to say what.