2017-05-28 122 views
0

我使用網頁將信息下載到Excel工作表中。具體而言,舊雅虎財務APIExcel QueryTable不加載網頁

myurl = "http://ichart.finance.yahoo.com/table.csv?s=AAPL&a=01&b=01&c=2016&d=01&e=01&f=2017&g=d&ignore=.csv" 

'this is the old web address 

With ws.QueryTables.Add(Connection:="URL;" & myurl, _ 
Destination:=ws.Range("a1")) 
      .BackgroundQuery = True 
      .TablesOnlyFromHTML = False 
      .Refresh BackgroundQuery:=False 
      .SaveData = True 

它的工作完美,直到一個月前。雅虎財經API改變,所以新的一個是:

myurl = "https://query1.finance.yahoo.com/v7/finance/download/AAPL?period1=1493218887&period2=1495810887&interval=1d&events=history&crumb=Uaszml8dA0M" 

'this is the new web address 

不知何故,當我更換了新的「myurl」時,PROGRAMM給出了一個1004的錯誤消息 「無法打開(myurl),你不能下載你的信息請求「

+0

我建議你使用'excel-vba yahoo finance'作爲搜索詞使用SO的搜索,然後將結果排序爲「最新」順序。你會發現很多相關的信息。 – YowE3K

回答