Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to pass on different parameters to VBA Code? Ahmaq Excel Worksheet Functions 2 April 22nd 07 04:30 AM
Shell can open an application, can it close an app too? quartz[_2_] Excel Programming 4 April 26th 05 03:30 PM
Pass variables value to Shell wpw3 Excel Programming 0 March 7th 05 04:55 PM
Shell command ignores parameters Pete[_22_] Excel Programming 2 February 15th 05 09:07 AM
Shell command ignores parameters Pete[_22_] Excel Programming 0 February 8th 05 05:39 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"