- 帖子
- 5923
- 主題
- 13
- 精華
- 1
- 積分
- 5986
- 點名
- 0
- 作業系統
- win10
- 軟體版本
- Office 2010
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台灣基隆
- 註冊時間
- 2010-5-1
- 最後登錄
- 2022-1-23
        
|
4#
發表於 2014-1-9 15:43
| 只看該作者
回復 3# t8899 - Option Explicit
- Sub TWSE_交易資訊()
- Dim YMD_day As String, N As Name, webURL As String
- YMD_day = InputBox("輸入 民國年度 : 102/10/07", "下載特定日期的資料", Format(Date - 1, "E/MM/DD")) '民國年度 "102/10/07"
- With ActiveSheet '可指定工作表
- '當日沖銷交易標的及統計
- webURL = "URL;http://www.twse.com.tw/ch/trading/exchange/TWTB4U/TWTB4U.php?input_date=" & YMD_day & "&login_btn=查詢.dat"
- '鉅額交易日成交資訊
- 'webURL = "URL; http://www.twse.com.tw/ch/trading/block/BFIAUU/BFIAUU.php?input_date=" & YMD_day & "&login_btn=查詢.dat"
- 'webURL = "URL; http://www.twse.com.tw/ch/trading/block/BFIAUU/BFIAUU.php?input_date=" & YMD_day & "&login_btn=%ACd%B8%DF.dat"
- If .QueryTables.Count = 0 Then
- .QueryTables.Add Connection:=webURL, Destination:=.Range("A1")
- Else
- .QueryTables(1).Connection = webURL
- End If
- .Cells.Clear
- With .QueryTables(1)
- .WebSelectionType = xlSpecifiedTables
- .WebFormatting = xlWebFormattingNone
- ' .WebTables = "data_table" '鉅額交易日成交資訊 :資料匯入的Tables
- .WebTables = "9,11" '當日沖銷交易標的及統計 :資料匯入的Tables
- .Refresh BackgroundQuery:=False
- End With
- End With
- End Sub
複製代碼 |
|