Hi everyone,
I am running into issues retrieving data back into excel after I automate the click on the web page. The html code that I believe has the results is
I am running into issues retrieving data back into excel after I automate the click on the web page. The html code that I believe has the results is
HTML:
div class="zipcode-result-address"> 123 FAKE ST
CHULA VISTA CA [B]91910-3885[/B]
The code is able to populate the webpage and search and I am not receiving an error as well, I'm just not getting anything back.
[CODE]Sub Atest()Dim objIE As InternetExplorer
Dim aEle As HTMLDivElement
Dim Result As String
Dim y As Integer
'innitiating a new instance of IE and assiging it to objIE
Set objIE = New InternetExplorer
'make IE browser visible
objIE.Visible = True
'navigate IE to this web page
objIE.navigate "https://tools.usps.com/zip-code-lookup.htm?byaddress"
'wait here a few seconds whilte the browser is busy
Do While objIE.Busy = True Or objIE.readyState <> 4: DoEvents: Loop
'enter the values in the fields
'Address
objIE.document.getElementsByName("tAddress").Item(0).Value = ThisWorkbook.Worksheets("Address Verification").Cells(5, 2).Value
'Zip
objIE.document.getElementsByName("tZip-byaddress").Item(0).Value = ThisWorkbook.Worksheets("Address Verification").Cells(5, 5).Value
'Click the find button
objIE.document.getElementById("zip-by-address").Click
'wait again for the browswer
Do While objIE.Busy = True Or objIE.readyState <> 4: DoEvents: Loop
'For each element in the collection of bjects with class of '"zipcode-result-address"
For Each elm In objIE.document.getElementsByClassName("zipcode-result-address")
MsgBox elm.innerText
Next elm
End Sub[/CODE]