I'm trying to get any response from a webpage using xmlhttp requests in vba. Whenever I try to execute the following script, I get this same message The system can't locate the resource specified.
Sub GetTitle()
Const URL$ = "https://jow.com/recipes/roasted-eggplant-with-yogurt-sauce-80uf18xsg48w043m0g4y/print"
Dim Html As HTMLDocument
Set Html = New HTMLDocument
With CreateObject("MSXML2.XMLHTTP")
.Open "Get", URL, False
.setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36"
.send
Html.body.innerHTML = .responseText
End With
MsgBox Html.querySelector("h1").innerText
End Sub
How can I get rid of that aforementioned message and fetch any response from that webpage using xmlhttp requests?