Share via


ShapeRange.ZOrder Method

Publisher Developer Reference

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 ShapeRange object.

Parameters

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

Return Value
Nothing

Remarks

The ZOrderCmd parameter can be one of the MsoZOrderCmd constants declared in the Microsoft Office type library and shown in the following table.

msoBringForward
msoBringInFrontOfText
msoBringToFront
msoSendBackward
msoSendBehindText
msoSendToBack

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

Example

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

Visual Basic for Applications
  With ActiveDocument.Pages(1).Shapes _
        .AddShape(Type:=msoShapeOval, _
        Left:=100, Top:=100, Width:=100, Height:=300)
    While .ZOrderPosition > 2
        .ZOrder ZOrderCmd:=msoSendBackward
    Wend
End With

See Also