Class ShapeNode (Excel VBA)
The class ShapeNode represents the geometry and the geometry-editing properties of the nodes in a user-defined freeform. To use a ShapeNode class variable it first needs to be instantiated, for example
Dim shpn as ShapeNode
Set shpn = ActiveChart.OLEObjects.ShapeRange.Nodes(Index:=1)
For Each
Here is an example of processing the ShapeNode items in a collection.
Dim shpnNode As ShapeNode
For Each shpnNode In ActiveChart.OLEObjects.ShapeRange.Nodes
Next shpnNode
EditingType
If the specified node is a vertex, this property returns a value that indicates how changes made to the node affect the two segments connected to the node.
This property is read-only. Use the SetEditingType method to set the value of this property.
Dim metEditingType As Office.MsoEditingType
metEditingType = ActiveChart.OLEObjects.ShapeRange.Nodes(1).EditingType
Points
Returns the position of the specified node as a coordinate pair. Each coordinate is expressed in points. Read-only Variant.
This property is read-only. Use the SetPosition method to set the value of this property.
Set myDocument = Worksheets(1)
With myDocument.Shapes(3).Nodes
pointsArray = .Item(2).Points
currXvalue = pointsArray(1, 1)
currYvalue = pointsArray(1, 2)
.SetPosition 2, currXvalue + 200, currYvalue + 300
End With
SegmentType
Returns a value that indicates whether the segment associated with the specified node is straight or curved. If the specified node is a control point for a curved segment, this property returns msoSegmentCurve.
Use the SetSegmentType method to set the value of this property.
Dim mstSegmentType As Office.MsoSegmentType
mstSegmentType = ActiveChart.OLEObjects.ShapeRange.Nodes(1).SegmentType