- 帖子
- 25
- 主題
- 4
- 精華
- 0
- 積分
- 50
- 點名
- 0
- 作業系統
- xp
- 軟體版本
- office 2003
- 閱讀權限
- 20
- 性別
- 男
- 註冊時間
- 2012-3-31
- 最後登錄
- 2014-6-8
|
14#
發表於 2012-4-22 14:09
| 只看該作者
本帖最後由 cudui 於 2012-4-22 14:12 編輯
再請問一下~~
我原先抓的是html的資料,可以不需再處理CSV檔匯入的問題,
(Connection:="URL;http://www.otc.org.tw/ch/stock/aftertrading/otc_quotes_no1430/SQUOTE_AL_" & myear & mmon & nowday & ".html" _
但是,使用html遇到的狀況是~
我擷取其他交易日的時候都沒問題,但一旦要匯入"2/10","4/10"...等n月 10日的交易資料時,
個股行情除檔名外,其餘就會是一片空白...(但n月20日.30日都沒問題,所以應該不是"0"的問題)
而我檢查實際連結也都正確,可以正確連結到該網頁
(http://www.otc.org.tw/ch/stock/aftertrading/otc_quotes_no1430/SQUOTE_AL_1010410.html)
而使用CSV則無此問題~~
有沒有大大可以幫忙解惑一下這到底是因為什麼????
謝謝!
附上原始碼如下:-
- '上櫃個股歷史資料
- With ActiveSheet.QueryTables.Add(Connection:="URL;http://www.otc.org.tw/ch/stock/aftertrading/otc_quotes_no1430/SQUOTE_AL_" & myear & mmon & nowday & ".html" _
- , 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,4"
- .WebPreFormattedTextToColumns = True
- .WebConsecutiveDelimitersAsOne = True
- .WebSingleBlockTextImport = False
- .WebDisableDateRecognition = False
- .WebDisableRedirections = False
- On Error Resume Next
- .Refresh BackgroundQuery:=False
-
- End With
複製代碼 |
|