Object Model Reference : Classes : P : Polygon : Properties : Polygon.Sides |
Property Sides As Long
Member of Polygon
The Sides property returns or specifies the number of sides for a polygon.
The following VBA example displays the number of polygons with a different number of sides in the current document.
Sub Test() |
Dim s As Shape |
Dim str As String |
Dim cnt(3 To 10) As Long, n As Long |
For n = 3 To 10 |
cnt(n) = 0 |
Next n |
For Each s In ActivePage.Shapes |
If s.Type = cdrPolygonShape Then |
n = s.Polygon.Sides |
If n > 9 Then n = 10 |
cnt(n) = cnt(n) + 1 |
End If |
Next s |
str = "The document contains" & vbCr & _ |
"the following polygons:" & vbCr & vbCr & _ |
"Sides" & vbTab & "Count" |
For n = 3 To 9 |
str = str & vbCr & n & vbTab & cnt(n) |
Next n |
If cnt(10) Then |
str = str & vbCr & "Other" & vbTab & cnt(10) |
End If |
MsgBox str |
End Sub |
Copyright 2013 Corel Corporation. All rights reserved.