sendkeys(keys,wait) how do I use wait

M

MM

How do I use the "Wait" when using Application.SendKeys
Example - Application.SendKeys("123456789",wait)
I need to have Excel wait for the keys to be processed before returning
control to the macro
 
G

Gary''s Student

Wait is not reliable. I use:

Sub PutValueIn()
Range("B2").Select
Application.SendKeys "abcd"
Application.SendKeys "{ENTER}"
DoEvents
' more stuff
End Sub

the DoEvents gives focus to the worksheet to handle the "keystrokes"

For an example of using SendKeys to communicate with another app:

http://msdn.microsoft.com/en-us/library/aa266281.aspx
 
Top