Share via


ZOrder Method

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.  

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).

expression.ZOrder(ZOrderCmd)

expression   Required. An expression that returns one of the objects in the Applies To list.

MsoZOrderCmd

MsoZOrderCmd can be one of these MsoZOrderCmd constants.
msoBringForward
msoBringInFrontOfText
msoBringToFront
msoSendBackward
msoSendBehindText
msoSendToBack

Remarks

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 slide.

  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