ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SHELL to open an application and pass parameters to it (https://www.excelbanter.com/excel-programming/334337-shell-open-application-pass-parameters.html)

jwkz

SHELL to open an application and pass parameters to it
 

I have a compiler that operates on an XML file to create a BGL graphic
file.

At a command prompt, the syntax is [bglcomp.exe test.xml] and th
output would be test.bgl.

Trying to automate this in the macro that creates the XML code, an
with both files in path C:\Temp, I tried:

ID = Shell("C:\Temp\bglcomp.exe test.xml")

This runs with no error messages, but does not compile the XML file.
What is the correct method

--
jwk
-----------------------------------------------------------------------
jwkz's Profile: http://www.excelforum.com/member.php...fo&userid=2516
View this thread: http://www.excelforum.com/showthread.php?threadid=38663


Jim Thomlinson[_4_]

SHELL to open an application and pass parameters to it
 
You could try...

ID = Shell("command.com /c C:\Temp\bglcomp.exe test.xml")

--
HTH...

Jim Thomlinson


"jwkz" wrote:


I have a compiler that operates on an XML file to create a BGL graphics
file.

At a command prompt, the syntax is [bglcomp.exe test.xml] and the
output would be test.bgl.

Trying to automate this in the macro that creates the XML code, and
with both files in path C:\Temp, I tried:

ID = Shell("C:\Temp\bglcomp.exe test.xml")

This runs with no error messages, but does not compile the XML file.
What is the correct method?


--
jwkz
------------------------------------------------------------------------
jwkz's Profile: http://www.excelforum.com/member.php...o&userid=25167
View this thread: http://www.excelforum.com/showthread...hreadid=386635



jwkz[_2_]

SHELL to open an application and pass parameters to it
 

Jim, thanks for the suggestion.

Your statement also runs without error, and delivers a valid ID number,
but does not compile the xml file.

I then tried putting a [,1] at the end to keep the app window open, to
see if there were any error messages there. However, the command
prompt window just flashes briefly, then closes. Unlike the old DOS
window in Win98, there seems to be no way to tell it to remain open
after the app terminates.

John


--
jwkz
------------------------------------------------------------------------
jwkz's Profile: http://www.excelforum.com/member.php...o&userid=25167
View this thread: http://www.excelforum.com/showthread...hreadid=386635


jwkz[_3_]

SHELL to open an application and pass parameters to it
 

For anyone else interested, there were two problems, now resolved.

1) Shell wants cmd, not command to open the command window

2) The "Temp" path in my example was really a nest of folders, an
included the "Program Files" folder. But the Shell command used woul
not accept the two-word folder name.

Restructuring the syntax as follows gives a successful result. I
passes two sequential commands, the first a DOS change directory t
open the folder, followed by the executable and the xml file it is t
compile.

x = Shell("cmd /c cd C:\Program Files\Subfolder&&bglcomp.ex
test.xml")

Could also have been done by calling a batch file, but this seem
cleaner

--
jwk
-----------------------------------------------------------------------
jwkz's Profile: http://www.excelforum.com/member.php...fo&userid=2516
View this thread: http://www.excelforum.com/showthread.php?threadid=38663



All times are GMT +1. The time now is 09:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com