Does the active message box become the Active Window" ? In this case
you could check for the Caption using something based on this :-
'== top ================================================
Declare Function GetActiveWindow Lib "user32" () As Long
Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _
(ByVal Hwnd As Long, ByVal lpString As String, ByVal cch As Long) As
Long
'========================
Sub GET_WINDOW_CAPTION()
'========================
MsgBox (ActiveWindowCaption)
End Sub
'-----------------------------------------
Function ActiveWindowCaption() As String
'-----------------------------------------
Dim strCaption As String
Dim lngLen As Long
'---------------------------------
strCaption = String$(255, vbNullChar)
lngLen = Len(strCaption)
If (GetWindowText(GetActiveWindow, strCaption, lngLen) 0) Then
ActiveWindowCaption = strCaption
End If
End Function
'== bottom ==================================
---
Message posted from
http://www.ExcelForum.com/