- 帖子
- 5923
- 主題
- 13
- 精華
- 1
- 積分
- 5986
- 點名
- 0
- 作業系統
- win10
- 軟體版本
- Office 2010
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台灣基隆
- 註冊時間
- 2010-5-1
- 最後登錄
- 2022-1-23
        
|
5#
發表於 2011-4-22 16:05
| 只看該作者
回復 4# mnsmrtl - Sub 新增查詢()
- Range("A1") = "2610" '股票代號
- Range("A3").Select
- With ActiveSheet.QueryTables.Add(Connection:= _
- "URL;http://tw.stock.yahoo.com/q/q?s=" & Range("a1"), 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
- End Sub
- '***** 已新增後查詢後 可修改A1的股票代號 查詢 *****
- Sub 更新查詢()
- With Range("A3").QueryTable
- .Connection = "URL;http://tw.stock.yahoo.com/q/q?s=" & Range("a1") '股票代號在[A1]
- .Refresh BackgroundQuery:=False
- .Name = .ResultRange.Cells(3, 1)
- End With
- End Sub
複製代碼 |
|