Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default batch file call from a macro - how ? and required batch format

Hi
Im trying to run a batch file (runit.bat) that contains the following
statements:

runfast.exe <temp.in
interpolate.exe
summit.exe
del int.log
del old.out

..exe are fortran files.

I just saved this text file with these statements to a file named runit.bat.
If I double click on the file - it will execute these sequentially as shown.

Im trying to run in excel from a macro. I tried putting this in a call
statement but it just flashes the DOS window real quick , doesnt run.

I can call an individual program, say runfast.exe, and it runs ok. If I try
to call runfast.exe by itself from within a batch file, it doesnt run either,
so its not just because I have a sequence of executable statements.

Im in XP, does a batch file need a special format or something to run from
excel 2003?

Please note my name - Im a primative VB user who likes the record button.
Thanks for your time.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default batch file call from a macro - how ? and required batch format

Try

Shell ("C:\runnit.bat")

Mike

"VB-rookie" wrote:

Hi
Im trying to run a batch file (runit.bat) that contains the following
statements:

runfast.exe <temp.in
interpolate.exe
summit.exe
del int.log
del old.out

.exe are fortran files.

I just saved this text file with these statements to a file named runit.bat.
If I double click on the file - it will execute these sequentially as shown.

Im trying to run in excel from a macro. I tried putting this in a call
statement but it just flashes the DOS window real quick , doesnt run.

I can call an individual program, say runfast.exe, and it runs ok. If I try
to call runfast.exe by itself from within a batch file, it doesnt run either,
so its not just because I have a sequence of executable statements.

Im in XP, does a batch file need a special format or something to run from
excel 2003?

Please note my name - Im a primative VB user who likes the record button.
Thanks for your time.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default batch file call from a macro - how ? and required batch format

I'd be willing to bet that this would work

http://www.mvps.org/access/general/gen0015.htm
--
HTH,
Barb Reinhardt




"VB-rookie" wrote:

Hi
Im trying to run a batch file (runit.bat) that contains the following
statements:

runfast.exe <temp.in
interpolate.exe
summit.exe
del int.log
del old.out

.exe are fortran files.

I just saved this text file with these statements to a file named runit.bat.
If I double click on the file - it will execute these sequentially as shown.

Im trying to run in excel from a macro. I tried putting this in a call
statement but it just flashes the DOS window real quick , doesnt run.

I can call an individual program, say runfast.exe, and it runs ok. If I try
to call runfast.exe by itself from within a batch file, it doesnt run either,
so its not just because I have a sequence of executable statements.

Im in XP, does a batch file need a special format or something to run from
excel 2003?

Please note my name - Im a primative VB user who likes the record button.
Thanks for your time.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default batch file call from a macro - how ? and required batch format


This still doesnt work, but it explained to me what the "/c" does in the
call command. If I omit that, it leaves the DOS window open. It shows Im
in My Documents folder, which I guess is my default, but this is not where
the program is, even though I called out the complete path to the program in
the call statement. I need to figure out how to direct it to the proper
directory.

This helped some Barb thank you.

"Barb Reinhardt" wrote:

I'd be willing to bet that this would work

http://www.mvps.org/access/general/gen0015.htm
--
HTH,
Barb Reinhardt




"VB-rookie" wrote:

Hi
Im trying to run a batch file (runit.bat) that contains the following
statements:

runfast.exe <temp.in
interpolate.exe
summit.exe
del int.log
del old.out

.exe are fortran files.

I just saved this text file with these statements to a file named runit.bat.
If I double click on the file - it will execute these sequentially as shown.

Im trying to run in excel from a macro. I tried putting this in a call
statement but it just flashes the DOS window real quick , doesnt run.

I can call an individual program, say runfast.exe, and it runs ok. If I try
to call runfast.exe by itself from within a batch file, it doesnt run either,
so its not just because I have a sequence of executable statements.

Im in XP, does a batch file need a special format or something to run from
excel 2003?

Please note my name - Im a primative VB user who likes the record button.
Thanks for your time.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 284
Default batch file call from a macro - how ? and required batch format

You might be needing the "/k" switch instead of the "/c" switch. When you
use the Shell function to run cmd.exe which then runs your batch file, the
VBA routine doesn't wait for the batch file to complete before running the
lines that follow in your routine.

Where exactly are you placing the batch file? Are you retrieving any output
from your fortran exe files or do you just want them to run and know that
the two file deletions at the end of your batch file happen?

It may end up being easier to use Shell to run each of your fortran
executable files and then delete int.log and old.out from your VBA routine
rather than run the batch file at all.

Steve Yandl


"VB-rookie" wrote in message
...

This still doesnt work, but it explained to me what the "/c" does in the
call command. If I omit that, it leaves the DOS window open. It shows
Im
in My Documents folder, which I guess is my default, but this is not where
the program is, even though I called out the complete path to the program
in
the call statement. I need to figure out how to direct it to the proper
directory.

This helped some Barb thank you.

"Barb Reinhardt" wrote:

I'd be willing to bet that this would work

http://www.mvps.org/access/general/gen0015.htm
--
HTH,
Barb Reinhardt




"VB-rookie" wrote:

Hi
Im trying to run a batch file (runit.bat) that contains the following
statements:

runfast.exe <temp.in
interpolate.exe
summit.exe
del int.log
del old.out

.exe are fortran files.

I just saved this text file with these statements to a file named
runit.bat.
If I double click on the file - it will execute these sequentially as
shown.

Im trying to run in excel from a macro. I tried putting this in a call
statement but it just flashes the DOS window real quick , doesnt run.

I can call an individual program, say runfast.exe, and it runs ok. If
I try
to call runfast.exe by itself from within a batch file, it doesnt run
either,
so its not just because I have a sequence of executable statements.

Im in XP, does a batch file need a special format or something to run
from
excel 2003?

Please note my name - Im a primative VB user who likes the record
button.
Thanks for your time.




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
Call a batch file from an Excel Macro Alex Horan Excel Discussion (Misc queries) 0 March 2nd 06 03:29 PM
Call a batch file from an Excel Macro Gary''s Student Excel Discussion (Misc queries) 0 March 2nd 06 03:26 PM
Run Excel Macro through Batch file LJi Excel Programming 3 August 3rd 05 06:48 PM
Help To Create Batch/Macro Required R.VENKATARAMAN Excel Programming 0 January 16th 05 04:50 AM
Macro to activate a Batch file ! Tarek[_2_] Excel Programming 3 October 13th 03 08:02 PM


All times are GMT +1. The time now is 10:15 PM.

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"