In Excel, how can I determine which worksheet tabs are currently in view across the bottom of the window (Sheet Tab)? i'm looking for a object property to show if this sheet tab is in view or it is under some other object.
Worksheet.Tab object has no related properties. UIAutomationElement has a property called .isOffScreen but it is allways giving false result no matter what the element is visible to user or not.
I tried UIAutomationElement and this is the code example so far.
Sub Test()
Dim AppObj As UIAutomationClient.IUIAutomationElement
Dim oInvokePattern As UIAutomationClient.IUIAutomationInvokePattern
Dim oAutomation As New CUIAutomation ' the UI Automation API\
Dim oPattern As UIAutomationClient.IUIAutomationLegacyIAccessiblePattern
Dim ouAutomation As New CUIAutomation
Set AppObj = WalkEnabledElements("Excel")
Dim ControlName As UIAutomationClient.IUIAutomationCondition
Dim ControlType As UIAutomationClient.IUIAutomationCondition
Set ControlName = ouAutomation.CreatePropertyCondition(UIA_NamePropertyId, "Sayfa7")
Set ControlType = ouAutomation.CreatePropertyCondition(UIA_ControlTypePropertyId, UIA_TabItemControlTypeId)
Dim testElement As IUIAutomationCondition
Set testElement = ouAutomation.CreateAndCondition(ControlName, ControlType)
Set MyElement = AppObj.FindFirst(TreeScope_Descendants, testElement)
If MyElement Is Nothing Then Exit Sub
Dim isOffscreenProperty As Variant
Debug.Print MyElement.CurrentIsOffscreen
Debug.Print MyElement.GetCurrentPropertyValue(UIA_IsOffscreenPropertyId)
End Sub
this allways gives me false as a result. i can't figure out if this object is visible (in the view) to user or not.