In case anyone's interested, I found an easy way to get the open window captions without using a callback function at
I have adapted it to write the captions from all open windows to the active excel sheet:
----
Option Explicit
' Declarations
Private Const GW_CHILD = 5
Private Const GW_HWNDNEXT = 2
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal _
wCmd As Long) As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _
(ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Sub getwindows()
Dim dhwnd As Long ' desktop window handle
Dim hwnd As Long ' window handle
Dim rval As Long ' return value
Dim wname As String ' window name
Dim i As Integer
dhwnd = GetDesktopWindow()
hwnd = GetWindow(dhwnd, GW_CHILD)
Range("a1").Activate
Do While hwnd <> 0
wname = Space(260)
rval = GetWindowText(hwnd, wname, 260)
wname = Left(wname, InStr(wname, Chr(0)) - 1)
If Len(wname) Then
ActiveCell.Value = wname
Activecell.Offset(1,0).Activate
End If
hwnd = GetWindow(hwnd, GW_HWNDNEXT)
Loop
End Sub