I am helping my friend to build a Excel Function to extract real time quote from Google Finance. I used "MSXML2.XMLHTTP" instead of using QuaryTable and would like to use the InStr Function to retrieve the price. Unfortunately, I could not find the real time quote in responseText of "https://www.google.com/finance?q=". So I change the URL to "https://www.google.com/finance/historical?q=", but the responseText was too long that I could not the most update date.
e.g.
<td class="rgt">144.60<td class="rgt">143.00<td class="rgt">144.10<td class="rgt rm">1,381,412<tr><td class="lm">Apr 13, 2015<td class="rgt">144.10<td class="rgt">145.00<td class="rgt">143.20<td class="rgt">144.10<td class="rgt rm">1,810,301
I could only retrieve the data on Apr 13, 2015 instead of Apr 30, 2015. I really appreciate if someone can advise me.
Here are my codes:
Function StockQuote(StockTicker)
Dim strURL As String, strCSV As String
Dim http As Object
strURL = "https://www.google.com/finance/historical?q=" & StockTicker
Set http = CreateObject("MSXML2.XMLHTTP")
http.Open "GET", strURL, False
http.Send
strCSV = http.responseText
Debug.Print strCSV
StockQuote = strCSV
Set http = Nothing
End Function
I would also like to know the difference between "MSXML2.XMLHTTP.3.0","MSXML2.ServerXMLHTTP" and "MSXML2.XMLHTTP".
Thanks.
Bookmarks