Is the Index of a Shape in a Shapes collection of a Worksheet always the same as its ZOrderPosition? (One cannot in principle inquire directly about the Index of a given Shape).
The rule "ZOrderPosition = index" for the shapes of an excel sheet is ** NOT ** true if you make a group of shapes. For example if you have the shapes "A","B","C","D,"E","F" in Zorder 1 to 6 and then you group shapes "B", "C", "D" together, you will break the "ZOrderPosition = index" rule for the shapes "E" and "F". If you list the shapes(i) you will get the following:
index ZOrder Name 1 1 "A" 2 2 "Group 1" 3 *6* "E" 4 *7* "F"
Here the code for getting the previous info:
Sub DebugListInfoOfShapes()
Dim i As Long
Debug.Print "Index ZOrder Name"
For i = 1 To ActiveSheet.Shapes.Count
Debug.Print i & " " _
& ActiveSheet.Shapes(i).ZOrderPosition _
& " " _
& ActiveSheet.Shapes(i).Name
Next i
End Sub
Hoping this clarify you question!
Regards, Andres
PD: If you want to see shapes "B", "C", "D" you have to loop inside the group using for example: ActiveSheet.Shapes(2).GroupItems(i)
for the case above.