API Documentation > CorelDRAW > 2025-v26 > SegmentRange > IVGSegmentRange
SegmentRange.Count property
Gets the number of segments in the range
Syntax:
Property Get Count() As Long
Remarks:
The Count property returns the number of segments in a segment range.
Examples:
The following VBA example displays the number of curve segments in the selected curve. It then lets you convert all curve segments to lines.
Sub Test()
Dim sgr As New SegmentRange
Dim seg As Segment
Dim r As VbMsgBoxResult
If ActiveShape Is Nothing Then Exit Sub
  If ActiveShape.Type <> cdrCurveShape Then

 MsgBox "Select a curve and try again"

 Exit Sub
  End If
  For Each seg In ActiveShape.Curve.Segments

 If seg.Type = cdrCurveSegment Then sgr.Add seg

 Next seg

 If sgr.Count = 0 Then


MsgBox "No curve segments found"

 Else


r = MsgBox(sgr.Count & " curve segments found. Convert them to lines?", vbYesNo)


If r = vbYes Then


  sgr.SetType cdrLineSegment


End If

 End If
  
End Sub