DiagramNodes Collection

Microsoft Excel Visual Basic

DiagramNodes Collection

         
Diagram DiagramNodes
DiagramNode

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 in the active worksheet is a diagram, selects the first node, and deletes it.

Sub FillDiagramNode()
    ActiveSheet.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 in the active worksheet is a diagram, selects all nodes, and fills them with the specified pattern.

Sub FillDiagramNodes()
    ActiveSheet.Shapes(1).Diagram.Nodes.SelectAll
    Selection.ShapeRange.Fill.Patterned msoPatternSmallConfetti
End Sub