MrExcel Publishing
Your One Stop for Excel Tips & Solutions

sendkeys


Posted by jason on January 11, 2002 11:16 AM

Can I use sendkeys to perform AlT Tab for windows?


Posted by jason on January 11, 2002 11:17 AM

That is ALT TAB...


Posted by Juan Pablo G. on January 11, 2002 11:20 AM

Re: That is ALT TAB...

Like this ?

Sub Alt()
SendKeys "%{TAB}"
End Sub

Juan Pablo G.


Posted by Jason on January 11, 2002 11:34 AM

Re: That is ALT TAB...

That doesnt seem to do anything.
I am trying to change focus from an application started from VB, back to the worksheet that executed the VB shell command.
The equivlent of pressing alt tab.


Posted by DK on January 11, 2002 12:07 PM

Re: That is ALT TAB...


Hello,

You can use something like AppActivate to return focus back to Excel e.g.

Sub OpenCalc()
x = Shell("CALC.EXE", vbNormalNoFocus)
AppActivate "Microsoft Excel"
End Sub

HTH,
D

Posted by Jason on January 14, 2002 5:00 AM

Thanks, that works great, & much easier than what i was trying