Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Share On Reddit
Contact us
Hide Buttons

VBA-Excel: Get ALL The Opened Internet Explorer (IE) using Microsoft Excel

To Get all the already opened Internet Explorer s(IE) using Microsoft Excel, say for example you several IE tabs are opened and you want to get all the information like their HWND property, URLs and Title.

Steps:

  • Create the object of Shell Application
  • Get all the windows using shellobject.Windows
  • Navigate all the windows
  • check if window is Internet Explorer
  • Get HWND property of Internet Explorer
  • Get Title of Internet Explorer
  • Get URL of Internet Explorer

Create the object of Shell Application

Set objShell = CreateObject(“Shell.Application”)

Get all the windows using shellobject.Windows

Set objAllWindows = objShell.Windows

Navigate all the windows

For Each ow In objAllWindows

check if window is Internet Explorer

If (InStr(1, ow, “Internet Explorer”, vbTextCompare)) Then

Get HWND property of Internet Explorer

ow.Hwnd

Get Title of Internet Explorer

ow.Document.Title

Get URL of Internet Explorer

ow.locationURL

Complete Code:

Sub getALLBrowsers()
    Dim mainWorkBook As Workbook
    i = 2
    
    Set objShell = CreateObject("Shell.Application")
    Set objAllWindows = objShell.Windows
    Set mainWorkBook = ActiveWorkbook
    
    For Each ow In objAllWindows
        If (InStr(1, ow, "Internet Explorer", vbTextCompare)) Then
            mainWorkBook.Sheets("browsers").Range("A" & i) = ow
            mainWorkBook.Sheets("browsers").Range("B" & i) = ow.Hwnd
            mainWorkBook.Sheets("browsers").Range("C" & i) = ow.Document.Title
            mainWorkBook.Sheets("browsers").Range("D" & i) = ow.locationURL
            i = i + 1
            'MsgBox ow.Hwnd & "  " & ow & "   " & ow.locationURL & "  " & ow.Document.Title
        End If
    Next
End Sub
Internet Explorer

Internet Explorer

All Opened IE Browser Informations

All Opened IE Browser Informations

 

You may also like...

3 Responses

  1. Ross says:

    I know this thread is a bit old, but I have modified your code to retrieve URLs from multiple open tabs in IE. However this issue I’m having is that when I get the URLs from the IE tabs, they’re not in the order that the IE Tabs were opened. Is there anyway to activate a specific tab to make sure I’m returning the URLs in correct order?

  2. Ross says:

    Sub GetURLs()

    ‘Requires reference to Microsoft Internet Controls
    Dim SWs As SHDocVw.ShellWindows, vIE As SHDocVw.InternetExplorer
    Dim Count As Integer
    Dim NewURL As String

    Count = 2

    ‘Establish link to IE application
    Set SWs = New SHDocVw.ShellWindows

    For Each vIE In SWs

    If vIE.LocationURL = “” Then

    Else

    Sheet1.Cells(Count, 2) = vIE.LocationURL
    Count = Count + 1

    End If

    Next

    Set SWs = Nothing
    Set vIE = Nothing

    End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: