Class ShapeNodes (Excel VBA)
A collection of all the ShapeNode objects in the specified freeform. To use a ShapeNodes class variable it first needs to be instantiated, for example
Dim sns as ShapeNodes
Set sns = Application.ActiveChart.OLEObjects.ShapeRange
Count
Returns an Integer value that represents the number of objects in the collection.
Dim lngCount As Long
lngCount = ActiveChart.OLEObjects.ShapeRange.Nodes.Count
Delete
Deletes the object.
Delete (Index)
Index: The index of the object to delete.
Dim lngIndex As Long: lngIndex =
ActiveChart.OLEObjects.ShapeRange.Nodes.Delete Index:=lngIndex
Insert
Inserts a node into a freeform shape.
Insert (Index, SegmentType, EditingType, X1, Y1, X2, Y2, X3, Y3)
Dim lngIndex As Long: lngIndex =
ActiveChart.OLEObjects.ShapeRange.Nodes.Insert Index:=lngIndex, SegmentType:=msoSegmentLine, EditingType:=msoEditingAuto, X1:=, Y1:=
Arguments
The following arguments are required:
Index (Long) - The number of the shape node after which to insert a new node.
SegmentType (Office.MsoSegmentType) - The segment type.
EditingType (Office.MsoEditingType) - The editing type.
X1 (Single) - If the EditingType of the new segment is msoEditingAuto, this argument specifies the horizontal distance, measured in points, from the upper-left corner of the document to the end point of the new segment. If the EditingType of the new node is msoEditingCorner, this argument specifies the horizontal distance, measured in points, from the upper-left corner of the document to the first control point for the new segment.
Y1 (Single) - If the EditingType of the new segment is msoEditingAuto, this argument specifies the vertical distance, measured in points, from the upper-left corner of the document to the end point of the new segment. If the EditingType of the new node is msoEditingCorner, this argument specifies the vertical distance, measured in points, from the upper-left corner of the document to the first control point for the new segment.
Optional arguments
The following arguments are optional
X2 (Single) - If the EditingType of the new segment is msoEditingCorner, this argument specifies the horizontal distance, measured in points, from the upper-left corner of the document to the second control point for the new segment. If the EditingType of the new segment is msoEditingAuto, don't specify a value for this argument.
Y2 (Single) - If the EditingType of the new segment is msoEditingCorner, this argument specifies the vertical distance, measured in points, from the upper-left corner of the document to the second control point for the new segment. If the EditingType of the new segment is msoEditingAuto, don't specify a value for this argument.
X3 (Single) - If the EditingType of the new segment is msoEditingCorner, this argument specifies the horizontal distance, measured in points, from the upper-left corner of the document to the end point of the new segment. If the EditingType of the new segment is msoEditingAuto, don't specify a value for this argument.
Y3 (Single) - If the EditingType of the new segment is msoEditingCorner, this argument specifies the vertical distance, measured in points, from the upper-left corner of the document to the end point of the new segment. If the EditingType of the new segment is msoEditingAuto, don't specify a value for this argument.
Item
Returns a single object from a collection.
Item (Index)
Index: The name or index number for the object.
Dim shpn As ShapeNode
Set shpn = ActiveChart.OLEObjects.ShapeRange.Nodes(Index:=1)
SetEditingType
Sets the editing type of the node specified by Index. If the node is a control point for a curved segment, this method sets the editing type of the node adjacent to it that joins two segments. Note that, depending on the editing type, this method may affect the position of adjacent nodes.
SetEditingType (Index, EditingType)
Dim lngIndex As Long: lngIndex =
ActiveChart.OLEObjects.ShapeRange.Nodes.SetEditingType Index:=lngIndex, EditingType:=msoEditingAuto
Arguments
The following arguments are required:
Index (Long) - The node whose editing type is to be set.
EditingType (Office.MsoEditingType) - The editing property of the vertex.
SetPosition
Sets the location of the node specified by Index. Note that, depending on the editing type of the node, this method may affect the position of adjacent nodes.
Dim lngIndex As Long: lngIndex =
ActiveChart.OLEObjects.ShapeRange.Nodes.SetPosition Index:=lngIndex, X1:=, Y1:=
Arguments
The following arguments are required:
Index (Long) - The node whose position is to be set.
X1 (Single) - The position (in points) of the new node relative to the upper-left corner of the document.
Y1 (Single) - The position (in points) of the new node relative to the upper-left corner of the document.
SetSegmentType
Sets the segment type of the segment that follows the node specified by Index. If the node is a control point for a curved segment, this method sets the segment type for that curve. Note that this may affect the total number of nodes by inserting or deleting adjacent nodes.
SetSegmentType (Index, SegmentType)
Dim lngIndex As Long: lngIndex =
ActiveChart.OLEObjects.ShapeRange.Nodes.SetSegmentType Index:=lngIndex, SegmentType:=msoSegmentLine
Arguments
The following arguments are required:
Index (Long) - The node whose segment type is to be set.
SegmentType (Office.MsoSegmentType) - Specifies if the segment is straight or curved.