- 帖子
- 3
- 主題
- 0
- 精華
- 0
- 積分
- 3
- 點名
- 0
- 作業系統
- win7
- 軟體版本
- office 2003
- 閱讀權限
- 10
- 性別
- 男
- 註冊時間
- 2015-3-12
- 最後登錄
- 2019-1-21
|
請問我是想將證交所的每日收盤行情(不含權證牛熊證),貼上excel,現在用post法該怎麼寫的
原本get法是這樣寫的
Sub getSIIPrice()
urlStr = "URL;http://www.twse.com.tw/ch/trading/exchange/MI_INDEX/genpage/Report" & Format(Sheets("UI").Range("A21").Value, "YYYYMM") & "/A112" & Format(Sheets("UI").Range("A21").Value, "YYYYMMDD") & "ALLBUT0999_1.php?select2=ALLBUT0999&chk_date=" & Year(Sheets("UI").Range("A21").Value) - 1911 & "/" & Format(Sheets("UI").Range("A21").Value, "MM/DD")
Sheets("SIIPrice").Select
Cells.Select
Selection.Delete Shift:=xlUp
With ActiveSheet.QueryTables.Add(Connection:= _
urlStr _
, Destination:=Range("A1"))
.Name = "19"
.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 = "10"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
.Delete
End With
End Sub
後來我將網址改為http://www.twse.com.tw/ch/trading/exchange/MI_INDEX/MI_INDEX.php
ActiveSheet.QueryTables.Add增加一個PostText參數卻不行
請問該如何更改呢? |
|