Vertices Property

Applies To

Drawing Object, DrawingObjects Collection.

Description

Returns or sets the vertices of a polygon or freehand drawing, as a two-dimensional array of vertex coordinates in points (1/72 inch) relative to the upper-left corner of cell A1. The x coordinate is in column one of the array, the y coordinate is in column two. Every drawing and polygon will have at least two vertices. Read-only.

See Also

AddVertex Method, Reshape Method.

Example

This example creates a new worksheet and then inserts a list of the vertex coordinates for drawing one on Sheet1.


Set newSheet = ActiveWorkbook.Worksheets.Add
allVertices = Worksheets("Sheet1").Drawings(1).Vertices
newSheet.Range("A1:C1").Font.Bold = True
newSheet.Range("A1").Value = "Vertex"
newSheet.Range("B1").Value = "X value"
newSheet.Range("C1").Value = "Y value"
for i = LBound(allVertices, 1) to UBound(allVertices, 1)
    newSheet.Cells(i + 1, 1) = i
    newSheet.Cells(i + 1, 2) = allVertices(i, 1)
    newSheet.Cells(i + 1, 3) = allVertices(i, 2)
Next i

Assuming that drawing one on Sheet1 is a polygon with at least six vertices, this example reshapes the polygon by moving vertex five 12 points (1/6 inch) in the X direction.


With Worksheets("Sheet1").Drawings(1)
    vX = .Vertices(5, 1)
    vY = .Vertices(5, 2)
    .Reshape vertex:=5, Insert:=False, Left:=vX + 12, Top:=vY
End With