Refresh a Browser Window

Someone in the public groups asked how to refresh a particular IE browser window. This is what I came up with, maybe there’s a better way. You have to set a reference to Microsoft Internet Controls to use this sub.

Sub Refreshbrowser()
Dim i As Long
Dim SWs As New SHDocVw.ShellWindows
For i = 0 To SWs.Count – 1
    If SWs(i).document.url = _
        “http://www.dicks-clicks.com/Excel.htm” Then
        
        SWs(i).Refresh
        Exit For
    End If
Next i
End Sub

Posted in Uncategorized


Posting code? Use <pre> tags for VBA and <code> tags for inline.

Leave a Reply

Your email address will not be published.