[問題] VBA擷取網路上xls檔的資料出錯
軟體:excel
版本:2010
我想試著抓msci台灣指數的權重表直接匯入excel
https://www.msci.com/eqb/custom_indexes/tw_performance.xls
過去使用的程式碼如下,抓網頁跟csv都可以用,但這次抓xls不行
會在.Refresh BackgroundQuery:=False 這裡顯示"不正確的web查詢"
請問高手們該如何解決?
Sub test()
Set DataSheet = ActiveSheet
Range("A1").CurrentRegion.ClearContents
qurl = "網址"
QueryQuote:
With ActiveSheet.QueryTables.Add(Connection:="URL;" & qurl,
Destination:=DataSheet.Range("A1"))
.AdjustColumnWidth = False
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.Refresh BackgroundQuery:=False
.SaveData = True
End With
End Sub
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 123.51.219.89
※ 文章網址: https://www.ptt.cc/bbs/Office/M.1471312491.A.C9F.html
→
08/16 10:06, , 1F
08/16 10:06, 1F
→
08/16 10:09, , 2F
08/16 10:09, 2F
→
08/16 10:15, , 3F
08/16 10:15, 3F
Office 近期熱門文章
PTT數位生活區 即時熱門文章