Muokkaa

Jaa


ShapeRange.Vertices property (Excel)

Returns the coordinates of the specified freeform drawing's vertices (and control points for Bézier curves) as a series of coordinate pairs. Use the array returned by this property as an argument to the AddCurve method or AddPolyLine method. Read-only Variant.

Syntax

expression.Vertices

expression A variable that represents a ShapeRange object.

Remarks

The following table shows how the Vertices property associates the values in the array vertArray() with the coordinates of a triangle's vertices.

vertArray element Contains
vertArray(1, 1) The horizontal distance from the first vertex to the left side of the document
vertArray(1, 2) The vertical distance from the first vertex to the top of the document
vertArray(2, 1) The horizontal distance from the second vertex to the left side of the document
vertArray(2, 2) The vertical distance from the second vertex to the top of the document
vertArray(3, 1) The horizontal distance from the third vertex to the left side of the document
vertArray(3, 2) The vertical distance from the third vertex to the top of the document

Example

This example assigns the vertex coordinates for shape one on myDocument to the array variable vertArray() and displays the coordinates for the first vertex.

Set myDocument = Worksheets(1) 
With myDocument.Shapes(1) 
 vertArray = .Vertices 
 x1 = vertArray(1, 1) 
 y1 = vertArray(1, 2) 
 MsgBox "First vertex coordinates: " & x1 & ", " & y1 
End With

This example creates a curve that has the same geometric description as shape one on myDocument. Shape one must contain 3 n+1 vertices for this example to succeed.

Set myDocument = Worksheets(1) 
With myDocument.Shapes 
 .AddCurve .Item(1).Vertices 
End With

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.