2017-05-28 44 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

回答