- 帖子
- 112
- 主題
- 19
- 精華
- 0
- 積分
- 136
- 點名
- 0
- 作業系統
- window
- 軟體版本
- excel
- 閱讀權限
- 20
- 性別
- 男
- 註冊時間
- 2013-3-12
- 最後登錄
- 2022-11-29

|
4#
發表於 2013-7-24 13:42
| 只看該作者
以下,跑了之後會發生 .Refresh BackgroundQuery:=False 錯誤,但若是直接將網址放上則ok,請問要如何修改,
謝謝~
Dim WebAddress as string
WebAddress = "http://tw.stock.yahoo.com/q/q?s=1101"
Range("a2").Select
'With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://tw.stock.yahoo.com/q/q?s=" & [a1] & "", Destination:=Selection) '新增查詢
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;WebAddress", Destination:=Selection) '新增查詢
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "6"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
.Name = .ResultRange.Cells(3, 1)
End With |
|