How to Get all currently open IE and Explorer windows
Posted on January 4, 2009
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 'System & API - How to Get all currently open IE and Explorer windows 'This requires a reference to Microsoft Internet Controls and to 'Microsoft Shell Controls and Automation. Option Explicit Sub ListShellWindows() 'Get all currently open IE and Explorer windows 'For IE windows, get location. For WE windows, get path. Dim objShell As Shell Dim objIE As InternetExplorer Dim objExplorer As ShellFolderView Dim obj As Object Set objShell = New Shell For Each obj In objShell.Windows If TypeName(obj.Document) = "HTMLDocument" Then Set objIE = obj Debug.Print objIE.LocationURL Else Set objExplorer = obj.Document Debug.Print objExplorer.FocusedItem.Path End If Next obj End Sub |