- 帖子
- 5923
- 主題
- 13
- 精華
- 1
- 積分
- 5986
- 點名
- 0
- 作業系統
- win10
- 軟體版本
- Office 2010
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台灣基隆
- 註冊時間
- 2010-5-1
- 最後登錄
- 2022-1-23
        
|
2#
發表於 2016-4-14 08:28
| 只看該作者
回復 1# xu123
試試看- Option Explicit
- Sub 台指期成_交分價_台指期_鉅亨網() 'TXFD6
- Dim oXmlhttp As Object, oHtmldoc As Object, Url As String
- Dim xTable As Object, xRow As Object, R As Integer, I As Integer
- Set oXmlhttp = CreateObject("msxml2.xmlhttp")
- Set oHtmldoc = CreateObject("htmlfile")
- Url = "http://www.cnyes.com/twfutures/futTst.aspx?code=TXFD6 "
- With oXmlhttp
- .Open "POST", Url, False
- .Send
- oHtmldoc.write .responseText
- End With
- Set xTable = oHtmldoc.all.tags("table")(1)
- With ActiveSheet
- .UsedRange.Clear
- For Each xRow In xTable.Rows
- R = R + 1
- For I = 0 To xRow.Cells.Length - 1
- .Cells(R, I + 1) = xRow.Cells(I).INNERTEXT
- Next
- Next
- End With
- End Sub
複製代碼 |
|