- 帖子
- 81
- 主題
- 2
- 精華
- 0
- 積分
- 95
- 點名
- 104
- 作業系統
- xp
- 軟體版本
- office 2003
- 閱讀權限
- 20
- 性別
- 男
- 註冊時間
- 2012-2-29
- 最後登錄
- 2025-4-14
           
|
5#
發表於 2012-4-20 07:14
| 只看該作者
''上櫃個股歷史資料
With ActiveSheet.QueryTables.Add(Connection:="URL;http://www.otc.org.tw/ch/stock/aftertrading/otc_quotes_no1430/SQUOTE_AL_" & myear & mmon & nowday & ".CSV" _
, Destination:=ActiveCell.Offset(2, 0))
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = True
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = False
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "1,2,3"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
Range("a3:a2200").Select
Selection.TextToColumns Destination:=Range("b4"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=True, Space:=False, Other:=False, FieldInfo _
:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), _
Array(7, 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), _
Array(14, 1), Array(15, 1)), TrailingMinusNumbers:=True
Range("a4:a2200").Delete
Rows("4:4").Select
Selection.Delete Shift:=xlUp
Columns("A:O").Select
Range("a1").Activate
Selection.ColumnWidth = 8
End Sub
試試看吧 |
|