Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Code to get data from Yahoo Finance
If I paste the following code in the address bar in IE, I get a window asking
me if I want to open or save a csv file which has the monthly highs for the stock for the time period specified: http://ichart.finance.yahoo.com/table.csv?s=(insert stock symbol)&a=12&b=01&c=2007&d=01&e=01&f=2009&g=m&igno re=.csv Here's the issue. I have a list of 332 stock symbols in a spreadsheet. I need the code that will insert the first stock symbol after "s=" in the above address, save the file to a specific folder and loop thru the list till the end. I have to evaluate these stocks on a monthly basis to determine the market-to-cost adjustment. This would be my final piece to fully automate the process. Thanks for your help! Tom |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Code to get data from Yahoo Finance
This retired EE Prof has hundreds of excel spreadsheets, all freely downloadable, that will do what you want and mo http://www.gummy-stuff.org/ cls |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Code to get data from Yahoo Finance
Can anybody tell me why I can't get the sendkey to work in this code. I put
the Stock symbol in the Active worksheet in cell A1. I just can't get the file saved properly. Sub GetStocks() Const READYSTATE_LOADING = 1 Folder = "c:\Temp\" URL1 = "http://ichart.finance.yahoo.com/table.csv?s=" URL2 = "&a=12&b=01&c=2007&d=01&e=01&f=2009&g=m&ignore=.cs v" Set IE = CreateObject("InternetExplorer.Application") IE.Visible = True RowCount = 1 Do While Range("A" & RowCount) < "" Stock = Range("A" & RowCount) On Error Resume Next Kill (Folder & Stock & ".csv") On Error GoTo 0 'get web page IE.Navigate2 URL1 & Stock & URL2 Do While IE.readystate < READYSTATE_LOADING DoEvents Loop 'Loop Application.Wait (Now + TimeValue("0:00:05")) AppActivate "File Download", True 'Alt S - Save File Application.SendKeys "%S", True 'Alt n - Enter filename Application.SendKeys "%n", True Application.SendKeys _ (Folder & Stock & ".csv{ENTER}"), True RowCount = RowCount + 1 Loop End Sub "Charles L. Snyder" wrote: This retired EE Prof has hundreds of excel spreadsheets, all freely downloadable, that will do what you want and mo http://www.gummy-stuff.org/ cls |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Import from finance.yahoo.com | Excel Programming | |||
Web queries & Yahoo! Finance | Excel Discussion (Misc queries) | |||
Sort CSV file from Yahoo Finance Query | Excel Programming | |||
Historical Stock Quotes - Yahoo Finance | Excel Programming | |||
vba yahoo! finance | Excel Programming |