ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Send Keys query (https://www.excelbanter.com/excel-programming/306318-send-keys-query.html)

Tasmin

Send Keys query
 
Hello,

I'm trying to use the Shell function and SendKeys
statement to open an application, type in my password and
then navigate to a certain point.

There are two problems. Firstly, the application takes a
while to open and therefore the sendkeys "misses". I've
got around this by using a timer, but as the length of
time taken to open the application varies, its a bit hit
and miss and I'm sure there must be a way of waiting for
the thing to load.

Secondly, sometimes the SendKeys just doesn't seem to
work. It'll reach a certain point and then stop.

Here is a sample of my code so far:

Private Sub Commandbutton1_Click()
Dim, myRun, Pausetime, Start
Pausetime = 8
Start = Timer

myRun = Shell("C:\program.exe",1)
Sendkeys "{DOWN 7}~", TRUE 'this bit selects a menu choice
Do While Timer < Start + Pausetime
DoEvents
Loop
SendKeys "Username{TAB}password~QA3~{TAB}(+{TAB}7)B", true
end sub





All times are GMT +1. The time now is 01:59 PM.

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