DiagramNodes Collection

Microsoft PowerPoint Visual Basic

DiagramNodes Collection

Diagram DiagramNodes
DiagramNode
Multiple objects

A collection of DiagramNode objects that represents all the nodes in a diagram.

Using the DiagramNodes collection

Use the Nodes property of the Diagram object to return a DiagramNodes collection. Use the Item method to select and work with a single diagram node in a diagram. This example assumes the first shape on the first slide in the active presentation is a diagram, selects the first node, and deletes it.

Sub FillDiagramNode()
    ActivePresentation.Slides(1).Shapes(1).Diagram.Nodes.Item(1).Delete
End Sub
		

Use the SelectAll method to select and work with all nodes in a diagram. This example assumes the first shape on the first slide in the active presentation is a diagram, selects all nodes, and fills them with the specified pattern.

Sub FillDiagramNodes()
    ActivePresentation.Slides(1).Shapes(1).Diagram.Nodes.SelectAll
    ActiveWindow.Selection.ShapeRange.Fill.Patterned _
        Pattern:=msoPatternSmallConfetti
End Sub