Nodes Property

Microsoft PowerPoint Visual Basic

Returns a DiagramNodes object that contains a flat list of all of the nodes in the specified diagram.

expression.Nodes

expression    Required. An expression that returns a Diagram object.

ShowNodes property as it applies to the Shape and ShapeRange objects.

Returns a ShapeNodes collection that represents the geometric description of the specified shape. Applies to Shape or ShapeRange objects that represent freeform drawings.

expression.Nodes

expression    Required. An expression that returns one of the above objects.

Example

ShowAs it applies to the Diagram object.

The following example returns the number of nodes in a newly-created diagram.

Sub ConvertPyramidDiagram()

    Dim dgnNode As DiagramNode
    Dim shpDiagram As Shape
    Dim intNodes As Integer

    'Create pyramid diagram and add first node
    Set shpDiagram = ActivePresentation.Slides(1).Shapes _
        .AddDiagram(Type:=msoDiagramPyramid, Left:=10, _
        Top:=15, Width:=400, Height:=475)
    Set dgnNode = shpDiagram.DiagramNode.Children.AddNode

    'Add three child nodes to the first node
    For intNodes = 1 To 3
        dgnNode.AddNode
    Next intNodes

    'Automatically layout diagram and convert to radial diagram
    With dgnNode.Diagram
        .AutoLayout = msoTrue
        .Convert Type:=msoDiagramRadial
    End With

    'Display the number of nodes in the diagram
    MsgBox dgnNode.Diagram.Nodes.Count

End Sub
				

ShowAs it applies to the Shape object.

This example adds a smooth node with a curved segment after node four in shape three on myDocument. Shape three must be a freeform drawing with at least four nodes.

Set myDocument = ActivePresentation.Slides(1)
With myDocument.Shapes(3).Nodes
    .Insert Index:=4, SegmentType:=msoSegmentCurve, _
        EditingType:=msoEditingSmooth, X1:=210, Y1:=100
End With