View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default sendkeys(keys,wait) how do I use wait

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
--
Gary''s Student - gsnu200832


"MM" wrote:

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

--
MM