2013年2月17日日曜日

vbaでhtmlの中身を取り出す

Sub test()

    Set sht = Sheets("Sheet1")
    RowCount = 1

    Set objIE = CreateObject("internetexplorer.application")
    With objIE
        .Visible = False
        .navigate "http://www.vbapro.info"
        Do While .Busy Or .readyState <> 4
            DoEvents
        Loop
        For Each ele In .document.all
            Select Case ele.tagName
                Case "DIV":
                    sht.Range("A" & RowCount) = ele.innertext
                    RowCount = RowCount + 1
            End Select
        Next ele
    End With
    Set objIE = Nothing
End Sub

0 件のコメント:

コメントを投稿