BlackHarry
New Member
- Joined
- Oct 9, 2017
- Messages
- 3
Hi
I have the below code, it opens the website www.reece.com.au/myaccount/login, but does not fill in the email and password (Correct information on code has been removed for privacy)
I assume it is not working as I have not referenced the correct name in HTML. I assume it is email and password, but I may be wrong. I also am unable to find if MyHTML_Element.Type = "submit" is actually submit. Can anyone please look at the HTML and tell me if I have the wrong information in my VBA?
Dim HTMLDoc As HTMLDocument
Dim MyBrowser As InternetExplorer
Sub MyReece()
Dim MyHTML_Element As IHTMLElement
Dim MyURL As String
On Error GoTo Err_Clear
MyURL = "https://www.reece.com.au/myaccount/login"
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 = "Infousername"
HTMLDoc.all.password.Value = "Info password"
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
I have the below code, it opens the website www.reece.com.au/myaccount/login, but does not fill in the email and password (Correct information on code has been removed for privacy)
I assume it is not working as I have not referenced the correct name in HTML. I assume it is email and password, but I may be wrong. I also am unable to find if MyHTML_Element.Type = "submit" is actually submit. Can anyone please look at the HTML and tell me if I have the wrong information in my VBA?
Dim HTMLDoc As HTMLDocument
Dim MyBrowser As InternetExplorer
Sub MyReece()
Dim MyHTML_Element As IHTMLElement
Dim MyURL As String
On Error GoTo Err_Clear
MyURL = "https://www.reece.com.au/myaccount/login"
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 = "Infousername"
HTMLDoc.all.password.Value = "Info password"
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