Hi All,
Using VBA to interact with IE is a new goal for me. I'm probably at an intermediate level with VBA now. So I'm more experienced but in no way a guru.
I'm trying to learn how to automate VBA and IE.
My code is stuck at the following:
Code
Sub GMAILNEW()
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
' Loop until Internet Explorer is ready
Do
Loop Until MyBrowser.readyState = READYSTATE_COMPLETE
' Set HTMLDOC as my Browser
Set HTMLDoc = MyBrowser.document
For Each oHTML_Element In HTMLDoc.getElementsByTagName("input")
Debug.Print oHTML_Element.Name
Next
' Input User Name
HTMLDoc.all.identifier.Value = "[email protected]" 'Enter your email id here
HTMLDoc.all.identifierNext.Click ' click the next button after the email is entered
' Loop until Internet Explorer is ready
Do
Loop Until MyBrowser.readyState = READYSTATE_COMPLETE
' Set HTMLDOC as my Browser
Set HTMLDoc = MyBrowser.document
For Each oHTML_Element In HTMLDoc.getElementsByTagName("input")
Debug.Print oHTML_Element.Name
Next
HTMLDoc.all.identifier.Value = "[email protected]" 'Enter your email id here
HTMLDoc.all.Password.Value = "" 'stuck here......
Display More
In the loop I can see the element "password" but for the life of me HTMLDoc.all.Password.Value =.... keeps erroring out for me.
Any help or good reference material to get my head around elements would be great!
Cheers