tags:

views:

57

answers:

3

What is the function to query the web from vb6?

What I am trying to do is to get data from yahoo finance. For example this url returns a csv file with the dividend value of General Electric:

http://finance.yahoo.com/d/quotes.csv?s=GE&f=d

I need to run this in a function and have the function return the answer.

A: 

You could use the WinHttp.WinHttpRequest COM object. And here's a similar question which provides an example.

Darin Dimitrov
+1  A: 

Speaking of Excel, you can create a web query. Would be trivial in your case.

Other than that, you can use the WinHttpRequest if you want to make your life a bit easier, or a socket if you don't. But then, there's no winsock control in Excel.

GSerg
A: 

For a simple GET request like this in VB6 you can also create a small UserControl that invokes its AsyncRead method. Such a control can perform multiple requests in parallel if desired, each one tagged with a PropertyName string for recognition when the results are returned.

Whichever approach you use be sure to set the options to bypass the local cache. Otherwise repeated queries will return the same value each time.

Bob Riemersma