View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
K Dales[_2_] K Dales[_2_] is offline
external usenet poster
 
Posts: 1,163
Default shell commands

If it is open and active you can use SendKeys. but you may need to make it
active first with AppActivate. Use AppActivate with the WIndow title (the
exact text shown in the title bar of your command prompt) and then SendKeys -
an example:

AppActivate "C:\WINNT\System32\command.com"
SendKeys ("dir{ENTER}")
for more info refer to help on these methods.

But depending on what you need to do with the command prompr there are other
and better ways - some built in VBA functions like FileFind or methods
available by adding a reference to the MS Scripting library. For more
advanced methods, it would be worth looking into these.

"Kevin Green" wrote:

I can get a cmd promt open with the shell command but once it open how do I
send commands to put in the cmmd line? EX: dir or anything simple like that?

Thanks,
Kevin