I'm trying to use the following vba code from familycomputerclub.com to log into my Gmail account. However, the code doesn't populate the input boxes and log into the site. I'm not sure what the issue is because I got it to work last night. I am using Internet Explorer 9 and Excel 2013.
I don't know what the problem is, I tried using 'GetElementById' and the 'all' object.
Sub MyGmail()
Dim MyHTML_Element As IHTMLElement
Dim MyURL As String
On Error GoTo Err_Clear
MyURL = "https://www.gmail.com"
Set MyBrowser = New InternetExplorer
MyBrowser.Silent = True
MyBrowser.navigate MyURL
MyBrowser.Visible = True
Do
Loop Until MyBrowser.readyState = READYSTATE_COMPLETE
Set HTMLDoc = MyBrowser.document
HTMLDoc.all.Email.Value = "[email protected]" 'Enter your email id here
HTMLDoc.all.passwd.Value = "abc+123" 'Enter your password here
For Each MyHTML_Element In HTMLDoc.getElementsByTagName("input")
If MyHTML_Element.Type = "submit" Then MyHTML_Element.Click: Exit For
Next
Err_Clear:
If Err <> 0 Then
Err.Clear
Resume Next
End If
End Sub
Thanks for your help.
Bookmarks