rpflynn Absent Member.
Absent Member.

Run STW command from Excel and Determine Success/Error

I have a SilkTest Workbench .Net script that reads commands from an Excel spreadsheet, such as START MY.EXE, OPEN DIALOG XXX, etc.  The silk script will execute each of the commands.  I added a button to the Excel file to run the script using the command line (wsh.Run "cmd.exe /S /C stw -s myscript", windowStyle, waitOnReturn).  I want to be able to determine within the spreadsheet vba code if the silk script was successful or not.  I saw some posts on checking %ERRORLEVEL% but I didn't see that env var after running the stw command.  Any help is appreciated.

1 Reply
AndySchott Absent Member.
Absent Member.

RE: Run STW command from Excel and Determine Success/Error

The reason that you can't get the value of %ERRORLEVEL% is because it is set within the cmd.exe process, not Excel.

This Stack Overflow question sounds like it's trying to do the same thing: https://stackoverflow.com/questions/1439200/vba-shell-and-wait-with-exit-code


The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.