View Single Post
  #1 (permalink)  
Old July 5th, 2003, 12:38 PM
charlie3 charlie3 is offline
Registered User
 
Join Date: Jul 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default SendKey commands

I'm am using SendKey commands in Excel. But cannot get them to work as they should.
 Set WshShell = WScript.CreateObject("WScript.Shell")
 WshShell.Run "Excel"
 WScript.Sleep 500
 WshShell.AppActivate "Microsoft Excel"
 WshShell.SendKeys "%+(t)"
 WScript.Sleep 250
 WshShell.SendKeys "m"
 WScript.Sleep 250
 WshShell.SendKeys "~"
 WScript.Sleep 250
 WshShell.SendKeys "~"

I'm using this little bit of script to open Excel and then go to the Macro command and run the first macro
Excep where I have WshShell.SendKeys "%+(t)" I tried using the Excel hot key to run the Macro Alt+F8 WshShell.SendKeys "^{F8}", but that didn't work. Then I tried the the Excel command to open the menu bar and go to "T" for tools then down to "M" for macro. Alt+T M. or WshShell.SendKeys "^{T}"
WScript.Sleep 250
 WshShell.SendKeys "m"

That doesn't work either

Why can't I use SendKeys with the Excel hotkeys?


Charlie3
[email protected]
Reply With Quote