First of all i'm using this code from https://www.teachexcel.com/excel-tutorial/2189/vba-macro-to-import-web-data-into-excel
It runs well in yahoo finance website, no problem at all
Then I modify the website url and the class name to suit my need, but it runs into error 91 Object Variable or With Block Variable Not Set
The website i'm trying is "https://item.taobao.com/item.htm?id=531457661561"
The classname of text i'm trying to get is "tb-rmb-num"
The whole code is as follow, any helps are very appreciated
Sub Get_Price()
Dim request As Object
Dim response As String
Dim html As New HTMLDocument
Dim website As String
' Website to go to.
website = "https://item.taobao.com/item.htm?id=531457661561"
' Create the object that will make the webpage request.
Set request = CreateObject("MSXML2.ServerXMLHTTP.6.0")
' Where to go and how to go there - probably don't need to change this.
request.Open "GET", website, False
' Send the request for the webpage.
request.send
' Get the webpage response data into a variable.
response = StrConv(request.responseBody, vbUnicode)
' Put the webpage into an html object to make data references easier.
html.body.innerHTML = response
' Get the price from the specified element on the page.
price = html.getElementsByClassName("tb-rmb-num")(0).innerText
' Output the price into a message box.
MsgBox price
End Sub