- 帖子
- 81
- 主題
- 3
- 精華
- 0
- 積分
- 95
- 點名
- 284
- 作業系統
- xp
- 軟體版本
- office 2003
- 閱讀權限
- 20
- 性別
- 男
- 註冊時間
- 2012-2-29
- 最後登錄
- 2026-10-11
            
|
2#
發表於 2012-4-8 08:16
| 只看該作者
回復 1# cudui
Sub 個股日成交資訊()
'
'
Dim ptxt As String
'Dim STK_NO, mmon As String
myear = InputBox("輸入查詢民國年", "個股日成交資訊")
If myear = "" Then
Exit Sub
Else
myear = myear + 1911
End If
mmon = InputBox("輸入查詢月,1-9月需補0如02月", "個股日成交資訊")
If mmon = "" Then Exit Sub
STK_NO = InputBox("輸入個股代碼", "個股日成交資訊")
If STK_NO = "" Then Exit Sub
mym = myear & mmon
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.twse.com.tw/ch/trading/exchange/STOCK_DAY/genpage/Report" & mym & "/" & mym & "_F3_1_8_" & STK_NO & ".php?STK_NO=" & STK_NO & "&myear=" & myear & "&mmon=" & mmon _
, Destination:=Range("A1"))
'
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = False
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingAll
.WebTables = "8"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub
試試看吧!! |
|