Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
anil_kumar_bt
Partner - Contributor
Partner - Contributor

Run Excel macro via QMC

Hello all,

Could anyone please tell me "Is it possible to run macro in excel via QMC".

We have one excel and it contains several macros, right we have running the macro manually when open the excel file.

To automate this process we had thought like create qmc task to run the Macro.

If quick help will be much appreciated.

12 Replies
marcus_sommer

You could use the execute-statement to trigger external programs, for example something like this:

Execute "C:\Program Files (x86)\Microsoft Office\OFFICE11\EXCEL.EXE" "D:\YourFile.xls"

You need to adjust the path to your current excel.exe. Noticeable is that these excel will be run like a background-service - it meant it won't be visible - maybe it could be changed by the excel-macro which needs to run with an OnOpen-trigger in this case. Therefore it could be helpful to include such things like a run-parameter.

Another possibility would be to use a dertour and start a windows tasks which then started your excel which I for example use if I need that the tasks runs with a different user:

EXECUTE schtasks.exe /Run /TN "QlikView Tasks\SynchronizeDataABC"

- Marcus

Anonymous
Not applicable

Hi Marcus,

thank you for your answer.

I did a task "Start" in task scheduer but Execute command is not working:

EXECUTE "%windir%\system32\taskschd.msc /s";

I am running windows 2008 Server (task scheduer like in Vista).

Problem is from running vbs script from Publisher. Qlikview verion: 11.

All solutions in forum didn't fix my problem.

help for help,

Jacek Antek

marcus_sommer

A statement like the following runs for me with Server 2008:

EXECUTE schtasks.exe /Run /TN "QlikView Tasks\SynchronizeDataABC"

Try it with manually triggering them in the qmc - if it then worked and not per qmc-schedule it meant that the cause is the login-user respectively a run without a user.

- Marcus

Anonymous
Not applicable

Thank You Marcus.

For me:

EXECUTE schtasks.exe /Run /TN "Start"

doesnt work in QV application in script code.

In Task Scheduler i created task Start:start.png

Task "Start" is running vbs script which is opening Excel with macro and closing it.

From Task Scheduer Task Start is working fine.

But from QV script it doesn't work at all.

Jacek

marcus_sommer

How had you tried it - reloading the qvw within the desktop client or manually triggering the task within the qmc or per scheduled qmc-task. If not yet done - try it in the above mentioned order.

One reason could be that you hadn't enabled the execution of the EXECUTION statement. There is a setting within the user-properties within the tab security and also within the settings.ini from the server (it's different by older and youger releases): Authorizing the Script EXECUTE Statement | Qlikview Cookbook.

- Marcus

Anonymous
Not applicable

Yes Marcus,

all matters of security things from post you have been provided I did and is still don't work.

I am triggering application manually from QV script editor and it is not working.

If it is not working from QMC if it is not working within Script loading...

I am trying to set up task scheduler without QlikView at all.

Jacek Antek

marcus_sommer

If you are running this from the desktop client and it did't work it meant that there are certain settings on the windows-task which prevent the external execution from the task - or meant it didn't work the task will be executed but the export failed?

- Marcus

Not applicable

Thank You Marcos for your support and help!

Maybe it was something wrong with my task scheduler - now it is working like a charm!

Warm regards,

Jacek Antek

mingsum214
Partner - Contributor III
Partner - Contributor III

I facing similar issue, which also calling a xlsm in QVW execute script. The testing is fine on QV desktop but when move to QMC reload, the qvw finish reload but the xlsm is not actuall running. 

Any workaround or solution?