Hi There,
I am trying to automate signing into Gmail account using VBA. I have the code, the issue I'm facing is it takes the username, hits the Next button but does not take the Password, throws an error. Tried the same code with facebook.com and it works fine. For the password field I'm using the "getElementsByName("Passwd").Item.innerText =pwd" as I do not find any Id element in the View Source page of Gmail.
Here is the code I have:
I am trying to automate signing into Gmail account using VBA. I have the code, the issue I'm facing is it takes the username, hits the Next button but does not take the Password, throws an error. Tried the same code with facebook.com and it works fine. For the password field I'm using the "getElementsByName("Passwd").Item.innerText =pwd" as I do not find any Id element in the View Source page of Gmail.
Here is the code I have:
Rich (BB code):
Dim HTMLDoc As HTMLDocument
Dim MyBrowser As InternetExplorer
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
With HTMLDoc
.getElementsByName("identifier").Item.innerText = "XXX" (OR) .getElementById("identifier").Value = "XXX"
.getElementById("identifierNext").Click
.getElementsByName("Passwd").Item.innerText = "XXX"----> Issue appears to be here
.getElementById("passwordNext").Click
End With
Err_Clear:
If Err <> 0 Then
Err.Clear
Resume Next
End If
End Sub
Last edited by a moderator: