[算表] VBA 上網抓取檔案

作者: randomness (隨機)   2018-04-12 18:23:48
軟體:EXCEL
版本:2003
如圖:https://imgur.com/a/ALXCw
不知斷點的部份要如何修改?
程式碼如下:
Sub 巨集1()
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;https://stock.wearn.com/fundthree.asp",
Destination:=Range("$A$1"))
.Name = "fundthree"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub
謝謝大家的解答!
<(_._)>
作者: soyoso (我是耀宗)   2018-04-12 18:59:00
有什麼錯誤訊息嗎?測試上是可以執行 https://i.imgur.com/cqlkqQH.jpg
作者: randomness (隨機)   2018-04-12 20:00:00
回s大,錯誤訊息如圖https://imgur.com/a/v8oSb然後按偵錯,就出現最後一行程式碼為黃色斷點.Refresh BackgroundQuery:=False 這一行
作者: soyoso (我是耀宗)   2018-04-12 20:17:00
那將網址貼至ie網址列上看是否可開啟
作者: randomness (隨機)   2018-04-12 20:20:00
回s大,我的電腦ie開不了,所以是ie的關係是嗎?https://imgur.com/a/JJAkQ
作者: soyoso (我是耀宗)   2018-04-12 20:27:00
有可能是這方面的緣故,調整ie方面可瀏覽該網址後再執行巨集試試
作者: randomness (隨機)   2018-04-12 20:32:00
好的,謝謝s大!!

Links booklink

Contact Us: admin [ a t ] ucptt.com