Excel vba 获取网页table表内容

Sub 提取行情报价()
    Dim html  As Object
    Cells.ClearContents
    Range("a1:e1") = Array("成交量", "開盤", "最高 ", "最低", "價格")
    Set html = CreateObject("HTMLFILE")
    With CreateObject("msxml2.xmlhttp")
    .Open "get", "http://histock.tw/szstock/300245", False
    .send
    html.body.innerhtml = .responseText
    Set tb = html.all.tags("table")(1).Rows
        Cells(2, 1).Value = tb(3).Cells(1).innertext
        Cells(2, 2).Value = tb(2).Cells(1).innertext
        Cells(2, 3).Value = tb(2).Cells(3).innertext
        Cells(2, 4).Value = tb(2).Cells(5).innertext
        Cells(2, 5).Value = tb(1).Cells(1).innertext
    End With
    Set html = Nothing
End Sub


Excel vba 获取网页table表内容


本站如无特别说明即为原创,转而告知:(http://iwonmo.com/archives/740.html)

标签: vb, excel

添加新评论