ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   sendkeys(keys,wait) how do I use wait (https://www.excelbanter.com/excel-discussion-misc-queries/220331-sendkeys-keys-wait-how-do-i-use-wait.html)

mm

sendkeys(keys,wait) how do I use wait
 
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

Gary''s Student

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



All times are GMT +1. The time now is 02:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com