InternetExplorer.Applicationを利用@Excel マクロ・VBA

InternetExplorer.Applicationを利用して、IEを操作します。

以下では、InternetExplorer.Applicationを生成し、
IEでgoogleを開いています。

また、サイトが開くのを待ち、
サイトの内容をDocument.body.innerTextにて取得し、表示しています。



Sub test()

    'IEオブジェクト生成
    Set ieObj = CreateObject("InternetExplorer.Application")

    'Treuに設定
    ieObj.Visible = True

    'サイトを開く
    ieObj.Navigate ("http://www.google.co.jp")

    'サイトが開くまで待つ
    Do While ieObj.Busy
    Loop

    'innerTextをMsbBoxで表示
    MsgBox ieObj.Document.body.innerText

    '解放
    Set IE = Nothing

End Sub




Copyright (C) Excelマクロ・VBAのお勉強. All Rights Reserved.