ExecuteCommand(LaunchExcel.vbs)

Post Reply
Dimix
Posts: 32
Joined: Fri Jan 15, 2016 2:53 pm
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2013

ExecuteCommand(LaunchExcel.vbs)

Post by Dimix »

Hi gurus, here is a challenge for you. ;)

I have spent days/weeks on this, read numerous posts, tried everything (?) you have suggested, but I still can't get it to work.

Background:
OS: Windows Server 2008 R2
TM1 version: 10.2.2 FP2
TM1 is running as a Windows service under the 'administrator' account, the same user I'm logged on as.

I want to launch an Excel spreadsheet via a TI process, and for that purpose I use ExecuteCommand.

vCmd = 'C:\windows\system32\cscript.exe C:\3TM1DATA\ixReporter\LaunchExcel.vbs';
ExecuteCommand( vCmd, 0);

The VB script:
'Just to see if the script is executed
Set objFSO=CreateObject("Scripting.FileSystemObject")
outFile="c:\Confirmation.inf"
Set objFile = objFSO.CreateTextFile(outFile,True)
objFile.Write "Script executed" & vbCrLf
objFile.Close

Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("C:\3TM1DATA\ixReporter\PL201601.xlsx")
objExcel.Application.Visible = True

Result:
The script runs, no error message, Confirmation.inf is correctly created, but the Excel spreadsheet is not launched. Running the VBscript via Windows Explorer (double click) and the command prompt works fine. It also works if I run TM1 as an application.

I have learned from earlier posts that it probably has to do with security, that the user that runs the TM1 service doesn't have the right privileges. However, it runs under the 'administrator' account, and it works fine if I log on as the same user and run the script 'manually'.

Seems to be different ways to configure the ExecuteCommand CommandLine statement. Have tried these:

vCmd = 'cmd /c " C:\3TM1DATA\ixReporter\LaunchExcel.vbs "';
ExecuteCommand( vCmd, 0 );

vCmd = 'C:\windows\system32\cscript.exe C:\3TM1DATA\ixReporter\LaunchExcel.vbs';
ExecuteCommand( vCmd, 0 );

Which is the correct way?

Found (here: http://www.tm1forum.com/viewtopic.php?f=3&t=7697) the suggestion to add a folder named 'Desktop' under C:\Windows\SysWOW64\config\systemprofile\ and C:\Windows\System32\config\systemprofile\, ...still no success.

I turned on the debug option in the TM1 log, but I can't find anything suspicious.

What have I missed, anything else I can try, are there any additional logs I can analyse?

THANKS!
User avatar
qml
MVP
Posts: 1094
Joined: Mon Feb 01, 2010 1:01 pm
OLAP Product: TM1 / Planning Analytics
Version: 2.0.9 and all previous
Excel Version: 2007 - 2016
Location: London, UK, Europe

Re: ExecuteCommand(LaunchExcel.vbs)

Post by qml »

Dimix wrote:I want to launch an Excel spreadsheet via a TI process, and for that purpose I use ExecuteCommand.
Please can you elaborate on what exactly you want to happen and where?

Executing a command like this can only result in the program being run on the server (not on the client machine). It will also be executed in a session of the service account, so you won't even get to see the interactive window. I suspect your LaunchExcel.vbs script is actually doing what it should do i.e. opening a spreadsheet in Excel - you could verify this by checking in Task Manager on the server if there are any instances of EXCEL.EXE running.
Kamil Arendt
tomok
MVP
Posts: 2832
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: ExecuteCommand(LaunchExcel.vbs)

Post by tomok »

Agreed. Why on earth would you want to launch an Excel instance on the server is beyond me. There is nothing that you could do with that spreadsheet because it is running on the server and only the console of the server would have access to it. If you are expecting to launch an Excel spreadsheet that a client would have access to then this approach will not accomplish that. I'm pretty sure there is no way to accomplish this via a TI.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
Dimix
Posts: 32
Joined: Fri Jan 15, 2016 2:53 pm
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2013

Re: ExecuteCommand(LaunchExcel.vbs)

Post by Dimix »

qml, you are absolutely right, I had 10 instances of EXCEL.EXE running on the server. :D But, I’m doing all this logged on to the physical TM1 server as the same user that is running the TM1 service. I can now clearly see that an instance of EXCEL.EXE is started when running the process, but why can’t I see the actual report? OR, is this maybe how ExecuteCommand works, it can initiate a new instance of an application, Excel, Notepad, IE (I have tried all these), but it will never open a new interactive window?

…and this takes me to the question: why am I doing this, why do I want to launch an Excel spreadsheet via ExecuteCommand?

I have a traditional financial report on an aggregated level, and I want the ability to drill from this report to a report that will list details for a combination of period, account, company, etc, and I want to do this via a right-click and Drill. I can of course use an Action button for this, but I think it’s more intuitive to right-click than to select a cell and then click a button (maybe I’m wrong). However, I want to use the Drill-through functionality to open a predefined report, not a new sheet with the default TM1 formating. My ideas was to create a simple drill process, and in this process, include the ExecuteCommand statement, which should launch the predefined, formatted report.

Maybe an Action button is the way to go…
Dimix
Posts: 32
Joined: Fri Jan 15, 2016 2:53 pm
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2013

Re: ExecuteCommand(LaunchExcel.vbs)

Post by Dimix »

tomok, the ideas was to launch an Excel spreadsheet that a client would have access to, but I think you and qml have pushed me in the right direction, it will probably not work. Thanks!
Post Reply