Shape.ZOrder method (PowerPoint)

Moves the specified shape in front of or behind other shapes in the collection (that is, changes the shape's position in the z-order).

Syntax

expression.ZOrder (ZOrderCmd)

expression A variable that represents a Shape object.

Parameters

Name Required/Optional Data type Description
ZOrderCmd Required MsoZOrderCmd Specifies where to move the specified shape relative to the other shapes.

Remarks

The ZOrderCmd parameter value can be one of these MsoZOrderCmd constants.

msoBringForward
msoBringInFrontOfText
msoBringToFront
msoSendBackward
msoSendBehindText
msoSendToBack

The msoBringInFrontOfText and msoSendBehindText constants should be used only in Microsoft Office Word.

Use the ZOrderPosition property to determine a shape's current position in the z-order.

Example

This example adds an oval to myDocument and then places the oval second from the back in the z-order if there is at least one other shape on the slide.

Set myDocument = ActivePresentation.Slides(1)

With myDocument.Shapes.AddShape(msoShapeOval, 100, 100, 100, 300)

    While .ZOrderPosition > 2

        .ZOrder msoSendBackward

    Wend

End With

See also

Shape Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.