I am have here a code to retrieve an actual price of a stock from Google Finance.
Unfortunetlly when I try to make it run it appears a "Compile error: User-defined type not defined." on the second line of the code "Dim http As New MSXML2.XMLHTTP"
I believe I've omited include some refrences.
Here's what I've additionaly mark off in Tools-References:
Thank you in advance.
Code:
<code>Function StockQuote(ByVal Stock)
Dim URL As String
Dim http As New MSXML2.XMLHTTP
Dim stockdoc As New HTMLDocument
URL = "https://www.google.com/finance?q=" & Stock
http.Open "GET", URL, False
http.Send
stockdoc.body.innerHTML = http.ResponseText
StockQuote = stockdoc.getElementsByClassName("pr")(0).innerText
Set http = Nothing
End Function</code>
I believe I've omited include some refrences.
Here's what I've additionaly mark off in Tools-References:
- Microsoft XML, v6
- Microsoft HTML Object Library
Thank you in advance.