Signing into Gmail Account using VBA

dubey

New Member
Joined
May 18, 2016
Messages
5
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:
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:

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,223,228
Messages
6,170,875
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top