まず、EXCEL VBA でIEを操作するために、参照設定を追加する必要があります。下記、手順の通りに2つのライブラリーを追加して下さい。
【追加するライブラリー】
●上記の設定を行わないと、下記のサンプルプログラムは、実行出来ません。
' '******** AKIRA55.COM ******* https://akira55.com/webpage01/ ' Sub InternetExplorer01() 'EXCEL VBA からInternetExplorerで指定したWebページを表示します。 Dim IEWeb As InternetExplorer Set IEWeb = CreateObject("InternetExplorer.application") IEWeb.Visible = True 'InternetExplorerを表示する。 IEWeb.Navigate "akira55.com" ''InternetExplorerで指定したURLのページを表示します。 End Sub '
' '******** AKIRA55.COM ******* https://akira55.com/webpage01/ ' Sub InternetExplorer02() '指定したワードをYahoo検索する。 Dim IEWeb As InternetExplorer Set IEWeb = CreateObject("InternetExplorer.application") IEWeb.Visible = True 'InternetExplorerを表示する IEWeb.Navigate "https://search.yahoo.co.jp/search?p=EXCEL VBA AKIRA" 'Yahoo検索するワードを指定します。 End Sub '
' '******** AKIRA55.COM ******* https://akira55.com/webpage01/ ' Sub InternetExplorer03() 'Yahoo検索する文字列を入力して検索を行う。 Dim IEWeb As InternetExplorer Dim Inp As String Set IEWeb = CreateObject("InternetExplorer.application") Inp = InputBox("Yahoo検索する文字列を入力") 'Yahoo検索を実行する検索ワードを入力します。 IEWeb.Visible = True 'InternetExplorerを表示する IEWeb.Navigate "https://search.yahoo.co.jp/search?p=" & Inp '入力した検索 End Sub '