Closing DOS window after shell command

G

Garry Boswell

I have a macro that runs the shell command to run a DOS
batchfile. At the end of the batchfile, the DOS window
will not close, even though the last line of the file is
EXIT. If I run the batchfile from a DOS window to begin
with, then the DOS window closes.

I am running Excel 2000 under Windows 98.

How can I close the DOS window from the macro?

TIA
Garry
 
J

jaf

Hi Garry,
RetVal = Shell(Environ$("comspec") & " /c yourfile.bat",vbNormalFocus)

The /c will kill the window. Use /k to keep it open.


--
John
johnf 202 at hotmail dot com


| I have a macro that runs the shell command to run a DOS
| batchfile. At the end of the batchfile, the DOS window
| will not close, even though the last line of the file is
| EXIT. If I run the batchfile from a DOS window to begin
| with, then the DOS window closes.
|
| I am running Excel 2000 under Windows 98.
|
| How can I close the DOS window from the macro?
|
| TIA
| Garry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top