Root 属性

       

返回一个 DiagramNode 对象,它表示源图表节点所属的根图表节点。只读。

expression.Root

expression   必需。该表达式返回一个 DiagramNode 对象。

示例

以下示例创建一个组织图表并将子节点添加到根图表节点。

Sub Root()
    Dim shpDiagram As Shape
    Dim dgnRoot As DiagramNode
    Dim intCount As Integer

    'Add organization chart to the current document
    Set shpDiagram = ThisDocument.Shapes.AddDiagram _
        (Type:=msoDiagramOrgChart, Left:=10, _
        Top:=15, Width:=400, Height:=475)

    'Add the first node to the diagram
    shpDiagram.DiagramNode.Children.AddNode

    'Assign the root diagram node to a variable
    Set dgnRoot = shpDiagram.DiagramNode.Root

    'Add three child nodes to the root node
    For intCount = 1 To 3
        dgnRoot.Children.AddNode
    Next intCount
End Sub