View Single Post
 
Old 05-20-2015, 10:54 PM
excelledsoftware excelledsoftware is offline Windows 8 Office 2003
IT Specialist
 
Join Date: Jan 2012
Location: Utah
Posts: 455
excelledsoftware will become famous soon enough
Default

Here is how I would accomplish it.
Code:
Sub test()
  ' open IE, navigate to the desired page and loop until fully loaded
  Set IE = CreateObject("InternetExplorer.Application")
  my_url = "https://www.google.com"
  
  With IE
    .Visible = True
    .Navigate my_url
    '.Top = 50
    '.Left = 530
    '.Height = 400
    '.Width = 400
    
    Do Until Not IE.Busy And IE.readyState = 4
      DoEvents
    Loop
    
  End With
  
  ' Input the userid and password
  IE.Document.getElementById("username").Value = "*******"
  IE.Document.getElementById("password").Value = "*******"
  
  ' Click the "Search" button
  
  'I find using loops is the best way to accomplish this.  Even though
  'it may run a tiny bit slower it is easiest to debug and do EXACTLY what you want.
  For Each v In IE.Document.GetElementsByTagName("input")
    If v.Value = "Sign in" Then
      v.Click
      Exit For
    End If
  Next v

End Sub
Let me know how that works out for you.

Thanks

Last edited by excelledsoftware; 05-20-2015 at 10:55 PM. Reason: indenting issue
Reply With Quote