API Documentation > CorelDRAW > 2025-v26 > Segment > IVGSegment
Segment.Previous method
Gets the segment preceding this one
Syntax:
Function Previous() As Segment
Remarks:
The Previous method returns the previous segment on a subpath. If the first segment is reached and the subpath is not closed, Nothing is returned
Examples:
The following VBA example creates a triangle, converts the three segments to curves, and changes the type of the bottom nodes to smooth, producing a shape resembling a droplet.
Sub Test()
Dim s As Shape
Dim seg As Segment
Set s = ActiveLayer.CreatePolygon(3, 6, 7, 2, 3)
s.ConvertToCurves
s.Curve.Nodes.Range(2, 4, 6).Delete
Set seg = s.Curve.Segments(2)
seg.Previous.Type = cdrCurveSegment
seg.Next.Type = cdrCurveSegment
seg.Type = cdrCurveSegment
seg.StartNode.Type = cdrSmoothNode
seg.EndNode.Type = cdrSmoothNode 
End Sub