- 帖子
- 5923
- 主題
- 13
- 精華
- 1
- 積分
- 5986
- 點名
- 0
- 作業系統
- win10
- 軟體版本
- Office 2010
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台灣基隆
- 註冊時間
- 2010-5-1
- 最後登錄
- 2022-1-23
        
|
本帖最後由 GBKEE 於 2013-12-9 15:53 編輯
回復 1# pupai
每一網頁的元素會有所不同.- Option Explicit
- Sub 外資及陸資買賣超彙總表()
- Dim URL As String, xDate As Date
- xDate = Format(Date-1, "E/M/D")
- URL = "URL;http://www.twse.com.tw/ch/trading/fund/TWT38U/TWT38U.php?qdate=" & xDate
- With ActiveSheet.QueryTables.Add(Connection:=URL, Destination:=ActiveSheet.Range("a1"))
- .WebSelectionType = xlSpecifiedTables
- .WebFormatting = xlWebFormattingNone
- .WebTables = "5"
- .WebPreFormattedTextToColumns = True
- .WebConsecutiveDelimitersAsOne = True
- .WebSingleBlockTextImport = False
- .WebDisableDateRecognition = False
- .WebDisableRedirections = False
- .Refresh BackgroundQuery:=False
- End With
- End Sub
- Sub 投信買賣超彙總表()
- Dim URL As String, xDate As Date
- xDate = Format(Date-1, "E/M/D")
- URL = "URL;http://www.twse.com.tw/ch/trading/fund/TWT44U/TWT44U.php?qdate=" & xDate
- With ActiveSheet.QueryTables.Add(Connection:=URL, Destination:=ActiveSheet.Range("D4"))
- .Connection = URL
- .WebSelectionType = xlSpecifiedTables
- .WebFormatting = xlWebFormattingNone
- .WebTables = "5"
- .WebPreFormattedTextToColumns = True
- .WebConsecutiveDelimitersAsOne = True
- .WebSingleBlockTextImport = False
- .WebDisableDateRecognition = False
- .WebDisableRedirections = False
- .Refresh BackgroundQuery:=False
- End With
- End Sub
複製代碼 |
|