Sub GetlastPrice()
Dim Html As New
HTMLDocument, elem$, price$
Dim ws As Worksheet, URL As String
Set ws = ThisWorkbook.Worksheets("Sheet2")
With CreateObject("MSXML2.XMLHTTP")
URL = "https://www1.nseindia.com/live_market/dynaContent/live_watch/get_quote/GetQuote.jsp?symbol=UBL"
.Open "GET", URL, False
.send
Html.body.innerHTML = .responseText
End With
elem = Html.querySelector("#responseDiv").innerText
price = Split(Split(elem, "lastPrice"":""")(1), """,")(0)
ws.Range("A2").Value = price1
End Sub
The vba run brings
1,020.25"}],"optLink":"/marketinfo/sym_map/symbolMapping.jsp?symbol=UBL&instrument=-&date=-&segmentLink=17&symbolCount=2
I just wanna 1,020.25
Please help