Skip to content

Files

Latest commit

 

History

History
50 lines (31 loc) · 1.45 KB

Excel.Shape.ZOrderPosition.md

File metadata and controls

50 lines (31 loc) · 1.45 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
Shape.ZOrderPosition property (Excel)
vbaxl10.chm636116
vbaxl10.chm636116
Excel.Shape.ZOrderPosition
aaf86516-bf5d-bdb5-1d88-eb1784f9b26f
05/14/2019
medium

Shape.ZOrderPosition property (Excel)

Returns the position of the specified shape in the z-order. Read-only Long.

Syntax

expression.ZOrderPosition

expression A variable that represents a Shape object.

Remarks

To set the shape's position in the z-order, use the ZOrder method.

A shape's position in the z-order corresponds to the shape's index number in the Shapes collection. For example, if there are four shapes on myDocument, the expression myDocument.Shapes(1) returns the shape at the back of the z-order, and the expression myDocument.Shapes(4) returns the shape at the front of the z-order.

Whenever you add a new shape to a collection, it's added to the front of the z-order by default.

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

Set myDocument = Worksheets(1) 
With myDocument.Shapes.AddShape(msoShapeOval, 100, 100, 100, 300) 
 While .ZOrderPosition > 2 
 .ZOrder msoSendBackward 
 Wend 
End With

[!includeSupport and feedback]