Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
petgr138
Partner - Contributor III
Partner - Contributor III

WScript.shell execution stops at Run command

Hello,

I'm trying to write a macro that executes an external program that creates an excel file which I want to load into my qlikview application.
I have tried using the WScript.Shell.Execute command to do this and it seems to work, however the external program is prone to some delay which causes the loading to fail sometimes.
I would like to use the WScript.Shell.Run command instead which has the built in functionality of waiting for a return value, i.e:


set WsShell = CreateObject("WScript.Shell")

WsShell.Run <Path to external exe-file>,1,true

However when trying to execute the macro the execution always stops at the WsShell.Run line with no error message.

Is there any solution to this problem?

Best regards

Petter Grundström

12 Replies
petgr138
Partner - Contributor III
Partner - Contributor III
Author

Now I also got it working. It was the spaces in the path to my exe-file that was the problem. By moving the exe it was possible.

But how do I get around it because I don't want to move the file?

If the path is: C:\Users\Petter\Desktop\Sub Folder\executable.exe

How would I write to get the script engine to interpret the file path correctly?

//Petter

marcus_sommer

The path respectively the complete statement must be in double-quotes wrapped. The correct syntax is really difficult and I couldn't never memorize it ... so I use most often trial and error ...

- Marcus

petgr138
Partner - Contributor III
Partner - Contributor III
Author

Thank you very much for your help! I finally got it working using trial and error with triple quotes on virtually everyhting.

//Petter