Send Keys query

T

Tasmin

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top