Calling a Macro From TI
-
- Posts: 27
- Joined: Tue Jan 10, 2012 9:13 am
- OLAP Product: Tm1 Cognos
- Version: 9.5.2
- Excel Version: 2007
Calling a Macro From TI
Hi All,
Is there any way to Call Macro from TI?
{Admin Note: Split from the topic "MACRO to Create a TI" since this thread has nothing to do with that topic.}
Is there any way to Call Macro from TI?
{Admin Note: Split from the topic "MACRO to Create a TI" since this thread has nothing to do with that topic.}
-
- 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: Calling a Macro From TI
No. TIs run on the server, macros run on the client side. If you look through the list of TI functions you'll notice that the one consistent thing is that they all do something on the server, never on the client. Off the top of my head I can't think of an exception to that. In many cases (scheduled chores) there won't even be a client.sg2012 wrote:Hi All,
Is there any way to Call Macro from TI?
"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.
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
- Martin Ryan
- Site Admin
- Posts: 1989
- Joined: Sat May 10, 2008 9:08 am
- OLAP Product: TM1
- Version: 10.1
- Excel Version: 2010
- Location: Wellington, New Zealand
- Contact:
Re: Calling a Macro From TI
Only workaround would be to run a batch file that loads the Excel workbook that runs the macro on load. But I'm sure there would be better ways.
What are you trying to achieve? The only thing I can assume is that you want to run a TI process, then run a macro. If that's the case, then call the TI process from Excel, then run the second macro.
Martin
What are you trying to achieve? The only thing I can assume is that you want to run a TI process, then run a macro. If that's the case, then call the TI process from Excel, then run the second macro.
Martin
Please do not send technical questions via private message or email. Post them in the forum where you'll probably get a faster reply, and everyone can benefit from the answers.
Jodi Ryan Family Lawyer
Jodi Ryan Family Lawyer
-
- Posts: 27
- Joined: Tue Jan 10, 2012 9:13 am
- OLAP Product: Tm1 Cognos
- Version: 9.5.2
- Excel Version: 2007
Re: Calling a Macro From TI
Even I was thinking of running a bat file.
But I dont want Macro to run at load time since I want the macro to record the time when I click on Action Button(Action Button runs TI.)
So I am thinking of Calling bat file from my TI.
And that bat file will call macro.
But then how to call bat file from TI?
Is there any command for the same?
But I dont want Macro to run at load time since I want the macro to record the time when I click on Action Button(Action Button runs TI.)
So I am thinking of Calling bat file from my TI.
And that bat file will call macro.
But then how to call bat file from TI?
Is there any command for the same?
-
- MVP
- Posts: 263
- Joined: Fri Jun 27, 2008 12:15 am
- OLAP Product: Cognos TM1, CX
- Version: 9.0 and up
- Excel Version: 2007 and up
Re: Calling a Macro From TI
Yes, there is.
Not telling though because I think the suggestions you already received in two other threads will be a better and also much easier way of achieving what you are trying to do.
Not telling though because I think the suggestions you already received in two other threads will be a better and also much easier way of achieving what you are trying to do.
-
- 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: Calling a Macro From TI
Or alternatively you have the TI write the value into a cube and read the cube value from a DBRW. In fact I'm sure that the same question with the same answer (from someone else) came up not so long ago. It's many times lower in complexity and higher in reliability.sg2012 wrote:Even I was thinking of running a bat file.
But I dont want Macro to run at load time since I want the macro to record the time when I click on Action Button(Action Button runs TI.)
So I am thinking of Calling bat file from my TI.
And that bat file will call macro.
"Before posting, please check the..." Oh what's the point. It's here.sg2012 wrote:But then how to call bat file from TI?
Is there any command for the same?
"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.
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
-
- Posts: 27
- Joined: Tue Jan 10, 2012 9:13 am
- OLAP Product: Tm1 Cognos
- Version: 9.5.2
- Excel Version: 2007
Re: Calling a Macro From TI
Hey I am So Sorry.
I framed wrong Question.
Yeah I knew ExecuteCommand().
But how to call Macro from bat file?
I have found something like this:
C:\temp\test.txt /m="C:\temp\macro.mac"
But its not workin..
Any other alternative?
I framed wrong Question.
Yeah I knew ExecuteCommand().
But how to call Macro from bat file?
I have found something like this:
C:\temp\test.txt /m="C:\temp\macro.mac"
But its not workin..
Any other alternative?
-
- 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: Calling a Macro From TI
Gee, I wonder why. Perhaps had you quoted the entire command line ofsg2012 wrote:Hey I am So Sorry.
I framed wrong Question.
Yeah I knew ExecuteCommand().
But how to call Macro from bat file?
I have found something like this:
C:\temp\test.txt /m="C:\temp\macro.mac"
But its not workin..
Code: Select all
uedit32 c:\temp\test.txt /m="c:\temp\macro.mac"
Since this is a really, really bad idea (as you've been told repeatedly by many people), and since I'm not in the business of propagating really, really bad ideas, I'm not going to spell out the solution.
But while I won't give you an actual road map to Hell, I will, however, give you a compass and point you in the right direction. It's then up to you whether you want to walk that path and if you do, well, Pilate isn't the only Roman who washes his hands of the consequences.
Consider:
- A Batch file can be used to launch the Excel executable (excel.exe) by simply specifying the full path to it.
- When you use a command line to launch Excel, you can open a file along with it by either putting the file in the xlStart folder (look it up in Excel Help; the relevant topic is "Customize how Excel starts"), or by including the path to the file in the command line.
- Alternatively if the .xls extension is correctly associated with Excel, all you would need to do is execute a command line pointing to an .xls file. That would automatically open Excel and load the file into it.
- You can have a macro run automatically upon load by creating it in the Workbook's Workbook_Open event. (Again, all explained in Excel's Help.)
Now, before you do this and get disappointed, you may want to consider the one thing that Martin didn't mention... where exactly do you think that the batch file will run? Consequently, where do you think that the Excel session will open?
Martin is correct if you want some kind of macro to run on the server alone. But if you're expecting this to be some sort of solution which will allow the server to communicate back to the users (which you may or may not, I have no idea what it is that you're trying to do).. this is not it.
"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.
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
-
- Posts: 27
- Joined: Tue Jan 10, 2012 9:13 am
- OLAP Product: Tm1 Cognos
- Version: 9.5.2
- Excel Version: 2007
Re: Calling a Macro From TI
Hey Alan Thanks a lot for your valuable response.
But I dont want Macro to run on opening the Excel page.
Instead i want my macro to run at the click of Action Button.
Your further guidance will be appreciated.

But I dont want Macro to run on opening the Excel page.
Instead i want my macro to run at the click of Action Button.
Your further guidance will be appreciated.

-
- 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: Calling a Macro From TI
The button isn't a standard one, by which I mean it isn't from the Forms library or the ActiveX collection. Instead it comes from a TM1 library. That means that it doesn't have the standard events like _Click.sg2012 wrote:Hey Alan Thanks a lot for your valuable response.
But I dont want Macro to run on opening the Excel page.
Instead i want my macro to run at the click of Action Button.
Your further guidance will be appreciated.
What it does do, though, (if that option is selected in the button's properties) is to recalculate the sheet. If you have just one volatile formula on the sheet (such as a =Now() function) and you avoid using code that causes an endless recalculation cycle, you can put code in the Worksheet_Calculate event to be triggered when the action button recalculates the sheet. This requires you to understand clearly that it will fire not once, but three times. The last time will be after the user clicks on the button confirming that the process has run successfully.
And with that, I am washing my hands of it. I have no idea why you're bound and determined to overlook at the most obvious and foolproof course of storing the relevant time in a cube, but my business is raising bridges when necessary, not lowering rivers for the hell of it.
"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.
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
-
- MVP
- Posts: 3703
- Joined: Fri Mar 13, 2009 11:14 am
- OLAP Product: TableManager1
- Version: PA 2.0.x
- Excel Version: Office 365
- Location: Switzerland
Re: Calling a Macro From TI
Let's go back to the beginning.
WHAT TO YOU WANT TO ACTUALLY DO?
As in what requirement needs to be filled here? An action button lets not forget can run a TI process and a TI process can do virtually anything within a TM1 server instance that you want; move data, write new data, create objects, set users and security, ... more or less limited only to your imagination. A TI can also call a batch file or a shell command to execute other scripts which could do many things on the physical server itself; create directories, copy files, start or stop other services, ... again only limited by your imagination.
You could think of any such code that is run as being rather like a "macro" if you really want to. So what is the point here?
WHAT TO YOU WANT TO ACTUALLY DO?
As in what requirement needs to be filled here? An action button lets not forget can run a TI process and a TI process can do virtually anything within a TM1 server instance that you want; move data, write new data, create objects, set users and security, ... more or less limited only to your imagination. A TI can also call a batch file or a shell command to execute other scripts which could do many things on the physical server itself; create directories, copy files, start or stop other services, ... again only limited by your imagination.
You could think of any such code that is run as being rather like a "macro" if you really want to. So what is the point here?
-
- MVP
- Posts: 263
- Joined: Fri Jun 27, 2008 12:15 am
- OLAP Product: Cognos TM1, CX
- Version: 9.0 and up
- Excel Version: 2007 and up
Re: Calling a Macro From TI
Think the beginning is here
http://www.tm1forum.com/viewtopic.php?f ... 481#p29481
might have changed to something else in the meantime though.
http://www.tm1forum.com/viewtopic.php?f ... 481#p29481
might have changed to something else in the meantime though.