Skip to content

Instantly share code, notes, and snippets.

@mtdtks
Created February 15, 2017 08:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mtdtks/e46bf899b5cbef34dfe3aded0393a4d4 to your computer and use it in GitHub Desktop.
Save mtdtks/e46bf899b5cbef34dfe3aded0393a4d4 to your computer and use it in GitHub Desktop.
IEを開きgoogleを表示する
Sub ie_test() 'IEテストする。
'IEの起動
Dim objIE As Object '変数を定義します。
Set objIE = CreateObject("InternetExplorer.Application") 'オブジェクトを作成します。
objIE.Visible = True '可視、Trueで見えるようにします。
'処理したいページを表示します。
objIE.navigate "http://www.google.co.jp/"
'ページの表示完了を待ちます。
While objIE.readyState <> 4 Or objIE.Busy = True '.ReadyState <> 4の間まわる。
DoEvents '重いので嫌いな人居るけど。
Wend
'google検索項目(name=q)にセットする。
objIE.Document.getElementsByName("q")(0).Value = "test"
'文章をMsgboxで表示する
MsgBox objIE.Document.All(0).InnerTEXT
MsgBox objIE.Document.All(0).InnerHTML
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment