I created the following program to extract data from website to excel sheet but it's showing error.
Error line:
price = html.getElementById("azimuth").Item(0).innerText"
Error message:
Run Time Error '91': with Object Variable or block variable not set
Novice in VBA.
Sub Get_Web_Data()
Dim request As Object
Dim response As String
Dim html As New HTMLDocument
Dim website As String
Dim price As Variant
website = "https://www.mooncalc.org/#/40.7146,-74.0071,9/2022.04.15/18:30/1/3"
Set request = CreateObject("MSXML2.XMLHTTP")
[enter image description here][1]
request.Open "GET", website, False
request.send
response = StrConv(request.responseBody, vbUnicode)
html.body.innerHTML = response
price = html.getElementById("azimuth").Item(0).innerText
Cells(2, "B") = price
End Sub