I need help on the following code.
I can put the data in the inputbox but it gives an error when submitting.
I think the problem comes from the "autocomplete" event
Sub VDF()
Dim IE As New SHDocVw.InternetExplorer
Dim HTMLDoc As MSHTML.HTMLDocument
Dim HTMLInput As MSHTML.IHTMLElement
IE.Visible = True
IE.navigate "https://www.vodafone.pt/pacotes/cobertura/"
Do While IE.Busy
Loop
Set HTMLDoc = IE.document
'Alternative to Do While IE.readyState <> READYSTATE_COMPLETE
Do While HTMLInput Is Nothing
Set HTMLInput = HTMLDoc.getElementById("checkCoverButton")
Loop
'Phone
Set HTMLInput = HTMLDoc.getElementById("phone-number")
HTMLInput.Value = "911111111"
'CP
Set HTMLInput = HTMLDoc.getElementById("postalCode")
HTMLInput.Value = Worksheet(1).Cells(4, 4)
'image 1 the code runs so far
'Submit form btn Pesquisar
Set HTMLInput = HTMLDoc.getElementById("checkCoverButton")
HTMLInput.Click
End Sub
The form fields are written after running the procedure but when submitting the form it gives an error as if the fields were blank