Good day. I am trying to lookup some Warranty Expiration dates via Internet Explorer and return the results to and Excel spreadsheet. Currently the code is very rudimentary. I have not yet added to code to read serial number from the worksheet or write the results back to the spreadsheet. I just wanted to test that I could actually identify and retrieve the data from IE (First time attempting something like this). I am getting intermittent Run-time error '91' messages. One time the code will run fine, the next time it will error out. Any help would be appreciated. Thank you
Sub DellWarrantyLookup()
Dim IE As SHDocVw.InternetExplorer
Set IE = New SHDocVw.InternetExplorer
IE.Visible = True
IE.navigate "https://www.dell.com/support/home/us/en/04/product-support/servicetag/9t4hkt2"
Do While IE.readyState <> READYSTATE_COMPLETE
Application.Wait Now + TimeValue("00:00:01")
Loop
Debug.Print IE.LocationName, IE.LocationURL
Dim Doc As HTMLDocument
Set Doc = IE.document
Dim strWarranty As String
strWarranty = Doc.getElementById("warrantyExpiringLabel").innerText <-----The error is on this line
Debug.Print strWarranty
End Sub
Sub DellWarrantyLookup()
Dim IE As SHDocVw.InternetExplorer
Set IE = New SHDocVw.InternetExplorer
IE.Visible = True
IE.navigate "https://www.dell.com/support/home/us/en/04/product-support/servicetag/9t4hkt2"
Do While IE.readyState <> READYSTATE_COMPLETE
Application.Wait Now + TimeValue("00:00:01")
Loop
Debug.Print IE.LocationName, IE.LocationURL
Dim Doc As HTMLDocument
Set Doc = IE.document
Dim strWarranty As String
strWarranty = Doc.getElementById("warrantyExpiringLabel").innerText <-----The error is on this line
Debug.Print strWarranty
End Sub
Last edited by a moderator: