I have been using the following Excel 2010 VBA code daily in a number of programs to download historical stock data for many years until last week when stopped working (ERR 1004 - unable to open in line 20). I have searched the internet for many days to no avail regarding a change in the web address or other solutions. Many sites use the same vba code I am using or similar code, which I have tried.
Question: Does anyone know if this address has been modified by Yahoo as they did a number of years ago, or has this type of query been discontinued by Yahoo, either permanently or temporarily?
Question: Can anyone give me an example of a VBA query for Yahoo historical data downloads that currently works?
Thanks in advance for any help you can provide in pointing me in the right direction.
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; white-space: inherit;"> qurl = "http://ichart.finance.yahoo.com/table.csv?s=" & Symbol
qurl = qurl & "&a=" & Month(StartDate) - 1 & "&b=" & Day(StartDate) & _
"&c=" & Year(StartDate) & "&d=" & Month(EndDate) - 1 & "&e=" & _
Day(EndDate) & "&f=" & Year(EndDate) & "&g=" & Range("E3") &
"&q=q&y=0&z=" & _
Symbol & "&x=.csv"
DataSheet.Range("H1") = qurl
On Error GoTo 90
QueryQuote:
With DataSheet.QueryTables.Add(Connection:="URL;" & qurl,
Destination:=DataSheet.Range("A2"))
.BackgroundQuery = True
.TablesOnlyFromHTML = False
20 .Refresh BackgroundQuery:=False
.SaveData = True
End With</code>
Question: Does anyone know if this address has been modified by Yahoo as they did a number of years ago, or has this type of query been discontinued by Yahoo, either permanently or temporarily?
Question: Can anyone give me an example of a VBA query for Yahoo historical data downloads that currently works?
Thanks in advance for any help you can provide in pointing me in the right direction.
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; white-space: inherit;"> qurl = "http://ichart.finance.yahoo.com/table.csv?s=" & Symbol
qurl = qurl & "&a=" & Month(StartDate) - 1 & "&b=" & Day(StartDate) & _
"&c=" & Year(StartDate) & "&d=" & Month(EndDate) - 1 & "&e=" & _
Day(EndDate) & "&f=" & Year(EndDate) & "&g=" & Range("E3") &
"&q=q&y=0&z=" & _
Symbol & "&x=.csv"
DataSheet.Range("H1") = qurl
On Error GoTo 90
QueryQuote:
With DataSheet.QueryTables.Add(Connection:="URL;" & qurl,
Destination:=DataSheet.Range("A2"))
.BackgroundQuery = True
.TablesOnlyFromHTML = False
20 .Refresh BackgroundQuery:=False
.SaveData = True
End With</code>