各位好
程式碼如下,下載資料後,是空空的,不知該改哪
所以想請各位幫幫忙
謝謝!! 感恩- Sub abc()
- Dim Theurl As String, Sdate
- Dim URL As String, xDate As String, A As Date
- A = Range("A2").Value
- xDate = Format(A, "E/MM/DD")
- Theurl = "http://www.otc.org.tw/ch/stock/3insti/DAILY_TradE/3itrade_download.php?t=D&d=" & xDate & "&s=0"
- With ActiveSheet.QueryTables.Add(Connection:="URL;" & Theurl, Destination:=Range("B3"))
- .BackgroundQuery = True
- .RefreshStyle = xlOverwriteCells
- .RefreshPeriod = 0
- .AdjustColumnWidth = False
- .WebSelectionType = xlSpecifiedTables
- .WebFormatting = xlWebFormattingNone
- '.WebTables = "1,2,3,4"
- .WebDisableDateRecognition = True '關閉日期辨識
- .Refresh BackgroundQuery:=False
- .ResultRange.Columns(1).TextToColumns Destination:=.ResultRange.Cells(1), 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), Array(16, 1), Array(17, 1), Array(18, 1), Array(19, 1), Array _
- (20, 1)), TrailingMinusNumbers:=True
- 'TextToColumns 方法 (資料剖析)的參數可錄製得到
- 'ResultRange.Columns(1):weby資料的第一欄
- 'ResultRange.Cells(1) :weby資料的第一個Cells(儲存格)
- '.Delete
-
-
- End With
- End Sub
複製代碼 |