I'm trying to create a macro that can send to back the "Rectangle" shapes in my current selection (which can have either Rectangle shapes or Pictures). I was trying to create one with an "IF" condition that checks if the shape is a picture or not, and if it's not then it will send the shape to the back. It works fine as long as there is only one object selected, but my goal is to select both Rectangles and Pictures at the same time, and then let the macro go through all of them and send only Rectangles to the back. I thought I had it, but the macro I tried does nothing.
The failed attempt below:
Dim oSh as Shape
For Each oSh In ActiveWindow.Selection.ShapeRange
If oSh.Type <> msoPicture Then
ActiveWindow.Selection.ShapeRange.ZOrder msoSendToBack
ElseIf oSh.Type = msoPicture Then
ActiveWindow.Selection.ShapeRange.ZOrder msoBringToFront
End If
Next oSh