API Documentation > CorelDRAW > 2025-v26 > Segment > IVGSegment
Segment.SubPath property
Gets the subpath to which the segment belongs
Syntax:
Property Get SubPath() As SubPath
Remarks:
The SubPath property returns the SubPath object to which a segment belongs.
Examples:
The following VBA example creates a curve with two subpaths. The subpath that contains the seventh segment is copied as a curve, and a shape is then created from that curve.
Sub Test()
Dim s As Shape, s2 As Shape
Dim sp As SubPath, sp2 As SubPath
Dim crv As Curve, crv2 As Curve
Set crv = CreateCurve(ActiveDocument)
ActiveDocument.ReferencePoint = cdrBottomLeft
Set sp = crv.CreateSubPath(1, 1)
sp.AppendLineSegment 1, 1
sp.AppendCurveSegment 3, 3
sp.AppendCurveSegment 5, 1
sp.AppendCurveSegment 6, 4
sp.Nodes(2).Type = cdrSmoothNode
sp.Nodes(3).Type = cdrSmoothNode
Set sp2 = crv.CreateSubPath(6, 4)
sp2.AppendLineSegment 5, 7
sp2.AppendCurveSegment 3, 5
sp2.AppendCurveSegment 1, 7
sp2.Nodes(3).Type = cdrSmoothNode
sp2.Nodes(4).Type = cdrSmoothNode
Set s = ActiveLayer.CreateCurve(crv)
Set sp2 = s.Curve.Segments(7).SubPath
Set crv2 = sp2.GetCopy
Set s2 = ActiveLayer.CreateCurve(crv2)
s2.Move 0, 1 
End Sub