DiagramNodes Collection

Microsoft Word Visual Basic

DiagramNodes Collection

Diagram DiagramNodes
DiagramNode
Multiple objects

A collection of DiagramNode objects that represent all the nodes in a diagram. The DiagramNodes collection contains all the diagram nodes in a specified diagram.

Using the DiagramNodes collection

Use the Nodes property to return the DiagramNodes collection. Use the SelectAll method to select and work with all nodes in a diagram. This example selects all nodes in the specified diagram and fills them with the specified pattern. The following example assumes the first shape in the active document is a diagram.

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

Use the Item method to select and work with a single diagram node in a diagram. This example selects the first node in the specified diagram and deletes it. The following example assumes the first shape in the active document is a diagram.

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