Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to send “Enter” key to cmd window from VBA script

Status
Not open for further replies.

yarondavid

Programmer
May 8, 2006
20
IL
Hi

I want to send and "Enter" key to the cmd window from VBA script

I use the following line in VBA script, but it doesn't work:
Call Shell("cmd.exe /K t:" + Chr$(13), vbNormalFocus)

Thanks,
Yaron
 

Hav you tried:
Code:
SendKeys "ENTER"
or
Code:
SendKeys "~"

Have fun.

---- Andy
 
The following code still doesn't work:
Call Shell("cmd.exe /K t:" + SendKeys("ENTER"), vbNormalFocus)

I get a Compile error message
 

No, you don't do that :)

Try:
Code:
Call Shell("cmd.exe, vbNormalFocus)[green]
'or whatever runs your cmd window [/green]

SendKeys "~" [green]'send Enter to your cmd[/green]

Have fun.

---- Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top