Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Alex
Contributor II
Contributor II

execute command and QMC

Hi all,

I am trying to execute a .vbs file which is running an embedded macro in Excel.
It works from my local pc but when it is deployed to QMC, gets completed successfully but doesn't execute the macro.
All security checks are enabled in settings.ini and .qvw so, don't know what's the problem.

 

My .qvw script:

EXECUTE cscript.exe "..\..\Folder_1\Folder_2\Script.vbs";

Script.vbs:

Option Explicit

Dim xlApp, xlBook, scriptdir

scriptdir = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName)
Set xlApp = CreateObject("excel.application")

Set xlBook = xlApp.Workbooks.Open(scriptdir & "\Macro_file.xlsm",0, False)
xlApp.Run "RefreshAll"
xlApp.Quit

Set xlBook = Nothing
Set xlApp = Nothing


Thanks in advance.

1 Solution

Accepted Solutions
marcus_sommer

This error could mean that there is no Excel installed, Excel isn't licenced, Excel settings didn't allow the use of ActiveX or ActiveX is globally denied (it's a very powerful feature and therefore relevant for security and often restricted) or something similar.

Just start Excel on the server directly and if everything worked you may execute some simple Excel macro with an ActiveX statement like CreateObject.

- Marcus

View solution in original post

9 Replies
zhadrakas
Specialist II
Specialist II

recheck both of these parameters

Security Tab in User preferences in QVW (STRG+ALT+U)

zhadrakas_0-1590743277895.png

 

AllowExecuteCommand=1 in Settings.ini

Path: C:\Windows\System32\config\systemprofile\AppData\Roaming\QlikTech\QlikViewBatch

Under [Settings 7] add following line

 

AllowExecuteCommand=1

 

after this you need to restart the qlik Services

 

Alex
Contributor II
Contributor II
Author

This is already correctly set up.

The point is that the task gets completed successfully but it is not triggering the macro.

zhadrakas
Specialist II
Specialist II

alright.

did you test that locally with the user that is assigned to the qlik Service?

 

martinpohl
Partner - Master
Partner - Master

Alex
Contributor II
Contributor II
Author

Hi,

I already checked but it is not working.

Same happens with .bat files, which do work when I execute them manually but not from the QMC.

I've tried almost everything and don't know what's the problem.

Thanks both!

marcus_sommer

There are a lot of possibilities which may cause the failure. To exclude most of them unless the QMC related ones  login to the server with the QV services-user and run there the reload with the desktop client. The usual missing access rights, invalid paths, missing Excel configurations/licences and similar should be popup more or less obvious.

- Marcus

Alex
Contributor II
Contributor II
Author

HI Zhdrakas/Marcus,

I've tried login with the QV services-user and run in the server the .qvw with the desktop client.
I've attached the error (ActiveX component can't create object 'excel,application')

The .qvw code which contains the execute statement is completed successfully when I execute it with my user either in local or the server.


Regards,

marcus_sommer

This error could mean that there is no Excel installed, Excel isn't licenced, Excel settings didn't allow the use of ActiveX or ActiveX is globally denied (it's a very powerful feature and therefore relevant for security and often restricted) or something similar.

Just start Excel on the server directly and if everything worked you may execute some simple Excel macro with an ActiveX statement like CreateObject.

- Marcus

Alex
Contributor II
Contributor II
Author

Indeed! Excel was not installed in the server.

I will talk to the team and try after installing the software. Will let you know.

Thanks for your support!