Proper use of Sendkeys (1 Viewer)

iworkonline

Registered User.
Local time
Today, 02:42
Joined
May 25, 2010
Messages
44
HI Guys

I am trying to send some tab keys to an IE browser but it is not working. Here is my code.
Code:
    Dim IE As Object
    Dim IEpage As Object
    Dim dummy As String
    Dim i As Integer
 
    Set IE = CreateObject("internetexplorer.application")
    IE.Visible = True
    With IE
     .Navigate "login page"
      'Do Until IE.ReadyState = 4 'READYSTATE_COMPLETE
      'DoEvents
       Do While .Busy
             DoEvents
        Loop
    End With
 
   Set IEpage = IE.Document
 
    AppActivate "Window Title", True
    Do Until IE.ReadyState = 4 'READYSTATE_COMPLETE
           DoEvents
    Loop
 
     i = 1
     Do While i <= 8
        SendKeys "{tab}", True
    i = i + 1
   Loop
   SendKeys "{Enter}", True
 
  'IE.Quit
  Set IE = Nothing
  Set IEpage = Nothing
Some extra information:
The page layout where I am sending tab keys is, it contains frames and I am sending tabs keys to a table row.

When I manually tab through the page and reach the first column in the first row, the color is changed to red and then by pressing Enter I can get the details

I appreciate your help, Thanks
 
Last edited:

boblarson

Smeghead
Local time
Today, 02:42
Joined
Jan 12, 2001
Messages
32,059
What's the 0.3 part? SendKeys "{tab}", 0.3

that isn't a parameter where you can state a length of time. It is a True or False (for Wait).
 

iworkonline

Registered User.
Local time
Today, 02:42
Joined
May 25, 2010
Messages
44
I had TRUE instead of 0.3 as I was jut expermineting by specifying the wait time. That's bad I didn't get a compile error.
 

boblarson

Smeghead
Local time
Today, 02:42
Joined
Jan 12, 2001
Messages
32,059
I had TRUE instead of 0.3 as I was jut expermineting by specifying the wait time. That's bad I didn't get a compile error.
Well, you wouldn't get a compile error. The constant TRUE and FALSE return a number. So, if you put in a non zero number it equates to TRUE. Anywhere you use TRUE in VBA - it can really have any number (even something like 29023 or -842038 as it doesn't matter to Access. Any non zero number will work. False equates to ZERO and that you have to use 0 if you use any number instead of the constant.

So, believe it or not, something like:

If Me.Dirty = vbRed Then Me.Dirty = 0

is the same as

If Me.Dirty Then Me.Dirty = False
 

Users who are viewing this thread

Top Bottom