Function IsModal(TitreFen) As Boolean
 Dim c As New CUIAutomation, oExcel As IUIAutomationElement, oUSF As IUIAutomationElement
  Set oExcel = c.ElementFromHandle(ByVal Application.ActiveWindow.Hwnd)
  Set oUSF = GetUiElem(c, oExcel, "Name", TitreFen, TreeScope_Children)
  Debug.Print oUSF.CurrentName
  IsModal = oUSF.GetCurrentPropertyValue(UIAutomationClient.UIA_WindowIsModalPropertyId)
  Debug.Print IsModal
End Function
Function GetUiElem(c As CUIAutomation, _
                       Parent As IUIAutomationElement, _
                       TypeCondition, _
                       ValCondition, _
                       ByVal TreeScope As TreeScope) As IUIAutomationElement
Dim x As Integer, obj As IUIAutomationElement, Condition As IUIAutomationCondition
x = 0
Select Case TypeCondition
    Case "Name"
          Set Condition = c.CreatePropertyCondition(UIAutomationClient.UIA_NamePropertyId, ValCondition)
    Case "AutoId"
          Set Condition = c.CreatePropertyCondition(UIAutomationClient.UIA_AutomationIdPropertyId, ValCondition)
    Case "Class"
          Set Condition = c.CreatePropertyCondition(UIAutomationClient.UIA_ClassNamePropertyId, ValCondition)
    Case "CtrlType"
          Set Condition = c.CreatePropertyCondition(UIAutomationClient.UIA_ControlTypePropertyId, ValCondition)
    Case Else
          Set Condition = c.CreateTrueCondition
    End Select
Set GetUiElem = Parent.FindFirst(TreeScope, Condition)
End Function
Sub Test()
   Debug.Print IsModal("Affichage TB")
End Sub