I see the note on the Yahoo blog stating they've discontinued support for iChart and I see this answer Yahoo Finance Historical data downloader url is not working discussing the newer request format for historical data.
Here is the original snippet of code I was using to download the historical data (it was part of a loop that created a tab in a spreadsheet per stock symbol)
With Sheets(SheetName).QueryTables.Add(Connection:="URL;http://ichart.finance.yahoo.com/table.csv?s=" & yahoosymbols & "&a=09&b=29&c=1984&d=04&e=12&f=2020&g=w&ignore=.csv", Destination:=DestinationRange)
.BackgroundQuery = True
.TablesOnlyFromHTML = True
.Refresh BackgroundQuery:=False
.SaveData = False
.FieldNames = False
End With
and here is the new code using the new version of the URL
With Sheets(SheetName).QueryTables.Add(Connection:="URL;http://query1.finance.yahoo.com/v7/finance/download/" & yahoosymbols & "?period1=947570400&period2=1577858400&interval=1wk&events=history&crumb=RhdXrQKrUXZ", Destination:=DestinationRange)
.BackgroundQuery = True
.TablesOnlyFromHTML = True
.Refresh BackgroundQuery:=False
.SaveData = False
.FieldNames = False
End With
If I copy and paste the url (subbing a stock symbol for the yahoosymbols variable) then it works fine in a browser.
But when I run this code then I get an excel 1004 error and says it is unable to open the url
Any thoughts? I am not a VBA guy so might be making a real amateur mistake. Thanks