Class ShapeNode (Word VBA)

The class ShapeNode represents the geometry and the geometry-editing properties of the nodes in a user-defined freeform. Nodes include the vertices between the segments of the freeform and the control points for curved segments. The ShapeNode object is a member of the ShapeNodes collection. The ShapeNodes collection contains all the nodes in a freeform.

The main procedure of class ShapeNode is ShapeNodes.Delete

For Each

Here is an example of processing the ShapeNode items in a collection.

Dim shp As Shape: Set shp = 
Dim shpnNode As ShapeNode
For Each shpnNode In shp.Nodes
	With shpnNode
		
	End With
Next shpnNode

Methods

This is the main method of the ShapeNode class

ShapeNodes.Delete - Deletes the specified shape node.

Dim lngIndex As Long: lngIndex = 
Dim sns As ShapeNodes: Set sns =  
sns.Delete Index:=lngIndex

Other Methods

ShapeNodes.Insert - Inserts a node into a freeform shape.

Dim lngIndex As Long: lngIndex = 
Dim sns As ShapeNodes: Set sns =  
sns.Insert Index:=lngIndex, SegmentType:=msoSegmentLine, EditingType:=msoEditingAuto, X1:=, Y1:=

ShapeNodes.SetEditingType - Sets the editing type of the node specified by Index.

Dim lngIndex As Long: lngIndex = 
Dim sns As ShapeNodes: Set sns =  
sns.SetEditingType Index:=lngIndex, EditingType:=msoEditingAuto

ShapeNodes.SetPosition - Sets the location of the node specified by Index.

Dim lngIndex As Long: lngIndex = 
Dim sns As ShapeNodes: Set sns =  
sns.SetPosition Index:=lngIndex, X1:=, Y1:=

ShapeNodes.SetSegmentType - Sets the segment type of the segment that follows the node specified by Index.

Dim lngIndex As Long: lngIndex = 
Dim sns As ShapeNodes: Set sns =  
sns.SetSegmentType Index:=lngIndex, SegmentType:=msoSegmentLine

Properties

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. Read-only MsoEditingType.

7 
Dim metEditingType As Office.MsoEditingType
metEditingType = shpn.EditingType

Parent returns an object that represents the parent object of the specified ShapeNode object.

7 
Dim objParent As Object
Set objParent = shpn.Parent

Points returns the position of the specified node as a coordinate pair. Read-only Variant.

7 
Dim pntsPoints As Points
Set pntsPoints = shpn.Points

SegmentType returns a value that indicates whether the segment associated with the specified node is straight or curved.

7 
Dim mstSegmentType As Office.MsoSegmentType
mstSegmentType = shpn.SegmentType

ShapeNodes.Count returns a Long that represents the number of shape nodes in the collection.

Dim sns As ShapeNodes: Set sns =  
Dim lngCount As Long
lngCount = sns.Count

ShapeNodes.Parent returns an object that represents the parent object of the specified ShapeNodes object.

Dim sns As ShapeNodes: Set sns =  
Dim objParent As Object
Set objParent = sns.Parent