Private Const GWL_STYLE As Long = -16
Private Const WS_DISABLED As Long = &H8000000
Private Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Public Function IsModal(ByRef voForm As Form) As Boolean
Dim oForm As Form
Dim bAnyWindowDisabled As Boolean
For Each oForm In Forms
If (GetWindowLong(oForm.hwnd, GWL_STYLE) And WS_DISABLED) = WS_DISABLED Then
bAnyWindowDisabled = True
ElseIf oForm Is voForm Then
IsModal = True
Else
IsModal = False
Exit Function
End If
Next oForm
IsModal = IsModal And bAnyWindowDisabled
End Function