ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error - SendKeys in between a macro (https://www.excelbanter.com/excel-programming/397792-re-error-sendkeys-between-macro.html)

Dave D-C[_3_]

Error - SendKeys in between a macro
 
Dileep wrote:
... SendKeys ..

To debug SendKeys, I've done the following:
replace
Sendkeys "ABC", True (Don't you want True?)
SendKeys "DEF", True
with
Call zSendKeys("ABC")
Call zSendKeys("DEF")

Sub zSendKeys(ps$)
Dim t!
Beep
t = Timer + 5 ' 5 seconds to switch to application
While Timer < t: DoEvents: Wend
SendKeys ps, True
t = Timer + 5 ' 5 seconds to look at action
While Timer < t: DoEvents: Wend
stop ' maybe
End Sub

You have to realize that switching windows may
reset the field selected. D-C


----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----


All times are GMT +1. The time now is 07:40 PM.

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