Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Sending "Enter" command to cmd.exe app...

Hi all,

I have written ( with much help from the message board ) a
macro in excel that opens a .BAT file, runs it, then
continues with the import of a text file. However, when
all is done, there is still a cmd.exe window left open in
the background waiting for "Press any key to
continue...". When any key is pressed within that app,
the app window is closed. Is there a way to send a
command from the excel macro to that app to close it? Any
help is much appreciated.

Thanks,

Trevor
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Sending "Enter" command to cmd.exe app...

If you add Exit as the last line of your batch file, does it close the
window?

--
Jim Rech
Excel MVP
"Trevor" wrote in message
...
| Hi all,
|
| I have written ( with much help from the message board ) a
| macro in excel that opens a .BAT file, runs it, then
| continues with the import of a text file. However, when
| all is done, there is still a cmd.exe window left open in
| the background waiting for "Press any key to
| continue...". When any key is pressed within that app,
| the app window is closed. Is there a way to send a
| command from the excel macro to that app to close it? Any
| help is much appreciated.
|
| Thanks,
|
| Trevor


  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Sending "Enter" command to cmd.exe app...

Mr. Rech,

You inspired a solution. The .BAT file that I was using
is on a network and is used by many others. Their needs
are different and therefore the file required a PAUSE for
user input and then executed the exit command. I simply
created my own .BAT file that does not need to PAUSE for
user input. Thank you for your help. It is much
appreciated.

Thanks,
Trevor

-----Original Message-----
If you add Exit as the last line of your batch file, does

it close the
window?

--
Jim Rech
Excel MVP
"Trevor" wrote in

message
...
| Hi all,
|
| I have written ( with much help from the message

board ) a
| macro in excel that opens a .BAT file, runs it, then
| continues with the import of a text file. However, when
| all is done, there is still a cmd.exe window left open

in
| the background waiting for "Press any key to
| continue...". When any key is pressed within that app,
| the app window is closed. Is there a way to send a
| command from the excel macro to that app to close it?

Any
| help is much appreciated.
|
| Thanks,
|
| Trevor


.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Sending "Enter" command to cmd.exe app...

Shell "cmd.exe /c c:\Myfile.Bat"

=
Regards,
Tom Ogilvy

"Trevor" wrote in message
...
Hi all,

I have written ( with much help from the message board ) a
macro in excel that opens a .BAT file, runs it, then
continues with the import of a text file. However, when
all is done, there is still a cmd.exe window left open in
the background waiting for "Press any key to
continue...". When any key is pressed within that app,
the app window is closed. Is there a way to send a
command from the excel macro to that app to close it? Any
help is much appreciated.

Thanks,

Trevor



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
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Help!!! Enter "7" in a cell and Excel changes the "7" to "11" immediately!!! [email protected] Excel Discussion (Misc queries) 3 January 5th 07 02:18 PM
Make "Edit" mode default, rather than "Enter"? Greg Boettcher Excel Discussion (Misc queries) 1 July 27th 06 01:46 AM
inserting a conditional "go to" command on a excel "if" function velasques Excel Worksheet Functions 5 March 10th 06 08:16 PM
Is there a "replace" or "Substitute" command in Excel's VB? [email protected] Excel Programming 2 December 5th 03 07:56 AM


All times are GMT +1. The time now is 04:16 PM.

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

About Us

"It's about Microsoft Excel"