I'm attempting to fill out a web form based on some VBA code I pulled from the interwebz - but when VBA fills in the text fields and I click submit - it does not recognize the text fields as completed - showing "Required*"
The web form i'm trying to fill out is https://www.retailmenot.com/everyday/unsubscribe I'm fairly new at this so any help is appreciated!
Sub RetailMeNot()
'RetailMeNot.com
Dim HTMLDoc As HTMLDocument
Dim oBrowser As InternetExplorer
Dim oHTML_Element As IHTMLElement
Dim sURL As String
Dim Name, Address, Apt, City, State, Zip, Email As String
Name = "Test"
Address = "123 Apple St"
Apt = ""
City = "New York"
State = "NY"
Zip = "123456"
Email = "Test@VBA.com"
'On Error GoTo Err_Clear
sURL = "https://www.retailmenot.com/everyday/unsubscribe"
Set oBrowser = New InternetExplorer
oBrowser.Silent = True
'oBrowser.timeout = 60
oBrowser.navigate sURL
oBrowser.Visible = True
Do
' Wait till the Browser is loaded
Loop Until oBrowser.readyState = READYSTATE_COMPLETE
Set HTMLDoc = oBrowser.document
HTMLDoc.getElementsByClassName("nameinputfield")(0).Value = Name
HTMLDoc.getElementsByClassName("address2inputfield").Item(0).Value = Address
HTMLDoc.getElementsByClassName("aptnuminputfield").Item(0).Value = Apt
HTMLDoc.getElementsByClassName("cityinputfield").Item(0).Value = City
HTMLDoc.getElementsByClassName("stateinputfield").Item(0).Value = State
HTMLDoc.getElementsByClassName("zipinputfield").Item(0).Value = Zip
HTMLDoc.getElementsByClassName("emailinputfield").Item(0).Value = Email
HTMLDoc.getElementsByClassName("input-checkbox").Item(0).Checked = True
HTMLDoc.getElementsByClassName("button-primary").Item(0).Click
Exit Sub
Err_Clear:
If Err <> 0 Then
Debug.Assert Err = 0
Err.Clear
Resume Next
End If
End Sub