Page 1 of 1

TM1 Worksheet Function

Posted: Mon Aug 10, 2009 1:06 am
by appleglaze28
Can you use TM1 Worksheet Function in your VBA script as any regular Worksheet Function? Are there extra parameters or script you need to write to make it work?

Any useful tips or best practice guide you guys can share with a beginner when utilizing TM1 Worksheet Function via VBA?

Re: TM1 Worksheet Function

Posted: Mon Aug 10, 2009 1:19 am
by Alan Kirk
appleglaze28 wrote:Can you use TM1 Worksheet Function in your VBA script as any regular Worksheet Function? Are there extra parameters or script you need to write to make it work?

Any useful tips or best practice guide you guys can share with a beginner when utilizing TM1 Worksheet Function via VBA?
You use the Application.Run method.

For example:

Code: Select all

MsgBox Application.Run("DBRW", "Server:Cube","Element1","Element2")
The first argument is the function name, then each of the arguments that you would pass to that function.

This is different from using standard Excel functions, which usually use either the WorksheetFunction property of the Application object, or (undocumented) use the Application object directly.

Re: TM1 Worksheet Function

Posted: Mon Aug 10, 2009 1:33 am
by appleglaze28
Okay...so the only difference would be adding the Applicaton.Run as well as the ServerName should always be included if I'm gonna base the parameters for the Function in the Reference guide.

Re: TM1 Worksheet Function

Posted: Mon Aug 10, 2009 1:49 am
by Alan Kirk
appleglaze28 wrote:Okay...so the only difference would be adding the Applicaton.Run as well as the ServerName should always be included if I'm gonna base the parameters for the Function in the Reference guide.
You need to use the server name regardless of how you're using the function, unless you're running a local server.

The primary difference is that the function name itself is the first argument that you pass to the Application.Run method.