Root Property

Microsoft PowerPoint Visual Basic

Root Property

       

Returns a DiagramNode object that represents the root diagram node to which the source diagram node belongs. 

expression.Root

expression   Required. An expression that returns one of the objects in the Applies To list.

Example

The following example creates an organization chart and adds child nodes to the root diagram node.

Sub AddChildNodesToRoot()

    Dim dgnNode As DiagramNode
    Dim shpOrgChart As Shape
    Dim intNodes As Integer
       
    'Adds organization chart and first node
    Set shpOrgChart = ActivePresentation.Slides(1).Shapes _
        .AddDiagram(Type:=msoDiagramOrgChart, Left:=10, _
        Top:=15, Width:=400, Height:=475)
    shpOrgChart.DiagramNode.Children.AddNode
   
    Set dgnNode = shpOrgChart.DiagramNode.Root
     
    'Adds three child nodes to root node
    For intNodes = 1 To 3
        dgnNode.Children.AddNode
    Next intNodes

End Sub