Hi all,
I'm trying to get a elements from a web page with MSXML library using Xpath but I'm not able to make it work.
For the code below that I have so far, I'm getting "Run-time error 13" in the line Set elem = doc.SelectNodes("//a[contains(.,'Message Board')]")
May someon help me with this. Thanks
I'm trying to get a elements from a web page with MSXML library using Xpath but I'm not able to make it work.
For the code below that I have so far, I'm getting "Run-time error 13" in the line Set elem = doc.SelectNodes("//a[contains(.,'Message Board')]")
May someon help me with this. Thanks
VBA Code:
Sub Test()
Dim URL As String
Dim oHttp As New MSXML2.XMLHTTP60
Dim elem As MSXML2.IXMLDOMNode
URL = "https://www.mrexcel.com/"
oHttp.Open "GET", URL, False
oHttp.send
Dim html As New HTMLDocument
html.body.innerHTML = oHttp.responseText
Set doc = New MSXML2.DOMDocument60
doc.SetProperty "SelectionLanguage", "XPath"
doc.Load oHttp.responseText
Set elem = doc.SelectNodes("//a[contains(.,'Message Board')]")
End Sub