- 帖子
- 1572
- 主題
- 16
- 精華
- 2
- 積分
- 1521
- 點名
- 0
- 作業系統
- xp
- 軟體版本
- office 2003
- 閱讀權限
- 150
- 性別
- 男
- 註冊時間
- 2010-5-1
- 最後登錄
- 2016-1-13

|
其實你錄製一下就可得到代碼,再把2610改成儲存格位址如[a1], 如此而已。- Sub Macro2()
- With ActiveSheet.QueryTables.Add(Connection:= _
- "URL;http://tw.stock.yahoo.com/d/s/company_" & [a1] & ".html", _
- Destination:=Range("A3"))
- .Name = "company_" & [a1]
- .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 = "9"
- .WebPreFormattedTextToColumns = True
- .WebConsecutiveDelimitersAsOne = True
- .WebSingleBlockTextImport = False
- .WebDisableDateRecognition = False
- .WebDisableRedirections = False
- .Refresh BackgroundQuery:=False
- End With
- End Sub
複製代碼 |
|