View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
jaf jaf is offline
external usenet poster
 
Posts: 300
Default Closing DOS window after shell command

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


"Garry Boswell" wrote in message
...
| 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