HOME > 即効テクニック集 > Excel VBA > その他関連のテクニック > ブラウザで表示したページを再読込する
その他関連のテクニック

ブラウザで表示したページを再読込する

(Excel 2000/2002/2003)
● 概要 ●

Internet Explorer で表示されている現在のページを再読込するには、InternetExplorerオブジェクトのRefreshメソッドを利用します。


 構文 オブジェクト.Refresh
 設定項目    内容
 オブジェクト  InternetExplorerオブジェクト


次のサンプルは、Refreshメソッドを利用して現在表示されているページを再読込します。このとき、ShellオブジェクトのWindowsメソッドの戻り値に対してループ処理をして、正しくInternetExplorerオブジェクトを取得するようにしています。
なお、このサンプルを実行するには、「Microsoft Shell Controls And Automationに参照設定をします。


● サンプル ●

Sub Sample()
    Dim TempShell As Shell32.Shell
    Dim TempBrowser As SHDocVw.InternetExplorer
    
    Set TempShell = New Shell32.Shell
    
    For Each TempBrowser In TempShell.Windows
        If UCase(Dir(TempBrowser.FullName)) = "IEXPLORE.EXE" Then
            TempBrowser.Refresh
        End If
    Next
End Sub