Posted on January 5, 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
| 'Internet - How to list URL of all open Internet Explorer and Windows Explorer windows
Option Explicit
'The following code will list the URL of all open Internet Explorer and Windows
'Explorer(with selected file) windows
Sub ListWindowsURL()
'Add reference to Microsoft Internet Controls and to Microsoft Shell Controls and Automation.
Dim oShell As Shell
Dim oIE As InternetExplorer
Dim oExplorer As ShellFolderView
Dim obj As Object
Set oShell = New Shell
For Each obj In oShell.Windows
If TypeName(obj.Document) = "HTMLDocument" Then
'It is an Internet Explorer window
Set oIE = obj
Debug.Print oIE.LocationURL
Else
'It is an Windows Explorer window
Set oExplorer = obj.Document
Debug.Print oExplorer.FocusedItem.Path
End If
Next obj
End Sub |