Created
February 15, 2017 08:08
-
-
Save mtdtks/e46bf899b5cbef34dfe3aded0393a4d4 to your computer and use it in GitHub Desktop.
IEを開きgoogleを表示する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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