PDA

View Full Version : Zorder query



balumail75
11-23-2011, 05:10 AM
Hello all,

How to create a vba code in ppt2007 to sort the zorder position for the selected shapes?

For eg., I have vertically 10 text boxes distributed equally with different zorder position. If I select all the 10 text boxes (from top to bottom) and run the code, the zorder position should be sorted from top to bottom.

Please help me on this.

Thanks and Regards,
Balu.

John Wilson
11-23-2011, 09:04 AM
Something based on this maybe:

Sub zsort()
Dim i As Integer
For i = 2 To ActiveWindow.Selection.ShapeRange.Count
Do
ActiveWindow.Selection.ShapeRange(i).ZOrder (msoBringForward)
Loop Until ActiveWindow.Selection.ShapeRange(i).ZOrderPosition > ActiveWindow.Selection.ShapeRange(i - 1).ZOrderPosition
Next i
End Sub