Class ShapeNode (PowerPoint VBA)

The class ShapeNode represents the geometry and the geometry-editing properties of the nodes in a user-defined freeform.

The main procedure of class ShapeNode is ShapeNodes.Delete

Set

To use a ShapeNode class variable it first needs to be instantiated, for example

Dim shpn as ShapeNode
Set shpn = ActiveWindow.RangeFromPoint.Nodes(Index:=1)

The following procedures can be used to set variables of type ShapeNode: ShapeNodes.Item, Shape.Nodes and ShapeRange.Nodes

Methods

This is the main method of the ShapeNode class

ShapeNodes.Delete - Deletes a shape node.

Dim lngIndex As Long: lngIndex = 
ActiveWindow.RangeFromPoint.Nodes.Delete Index:=lngIndex

Other Methods

ShapeNodes.Insert - Inserts a new segment after the specified node of the freeform.

Dim lngIndex As Long: lngIndex = 
ActivePresentation.Slides(1).Shapes(1).Nodes.Insert Index:=lngIndex, SegmentType:=msoSegmentLine, EditingType:=msoEditingAuto, X1:=210, Y1:=100

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

Dim lngIndex As Long: lngIndex = 
ActivePresentation.Slides(1).Shapes(1).Nodes.SetEditingType Index:=lngIndex, EditingType:=msoEditingAuto

ShapeNodes.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 = 
ActivePresentation.Slides(1).Shapes(1).Nodes.SetPosition Index:=lngIndex, X1:=210, Y1:=100

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

Dim lngIndex As Long: lngIndex = 
ActivePresentation.Slides(1).Shapes(1).Nodes.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. If the node is a control point for a curved segment, this property returns the editing type of the adjacent vertex.

Dim metEditingType As Office.MsoEditingType
metEditingType = ActivePresentation.Slides(1).Shapes(1).Nodes(1).EditingType

Parent returns the parent object for the specified object.

Dim objParent As Object
Set objParent = ActiveWindow.RangeFromPoint.Nodes(1).Parent

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

Dim pointsArray As vARIANT
pointsArray = ActivePresentation.Slides(1).Shapes(1).Nodes(1).Points

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

Dim mstSegmentType As Office.MsoSegmentType
mstSegmentType = ActivePresentation.Slides(1).Shapes(1).Nodes(1).SegmentType

ShapeNodes.Count returns the number of objects in the specified collection.

Dim lngCount As Long
lngCount = ActiveWindow.RangeFromPoint.Nodes.Count

ShapeNodes.Parent returns the parent object for the specified object.

Dim objParent As Object
Set objParent = ActiveWindow.RangeFromPoint.Nodes.Parent