I couldn't solve the 91 error in this code :
Sub textCheck()
Dim IE As Object
Dim doc As HTMLDocument
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.navigate "https://sanctionssearch.ofac.treas.gov/"
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
Set doc = IE.Document
doc.getElementById("ctl00_MainContent_btnSearch").Click
If InStr(doc.getElementById("ctl00_MainContent_lblMessage").innerText , "Your search has not returned any results.") = 0 Then ' my error is here
Sheet1.Range("D1") = "Fail"
Else
Sheet1.Range("D1") = "Success"
End If
'Set rrr = doc.getElementById("ctl00_MainContent_lblMessage")
Application.Wait DateAdd("s", 2, Now)
IE.Quit
End Sub
Sub textCheck()
Dim IE As Object
Dim doc As HTMLDocument
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.navigate "https://sanctionssearch.ofac.treas.gov/"
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
Set doc = IE.Document
doc.getElementById("ctl00_MainContent_btnSearch").Click
If InStr(doc.getElementById("ctl00_MainContent_lblMessage").innerText , "Your search has not returned any results.") = 0 Then ' my error is here
Sheet1.Range("D1") = "Fail"
Else
Sheet1.Range("D1") = "Success"
End If
'Set rrr = doc.getElementById("ctl00_MainContent_lblMessage")
Application.Wait DateAdd("s", 2, Now)
IE.Quit
End Sub