返回 DiagramNode 对象,该对象代表图示源节点所属的图示根节点。
expression.Root
expression 必选。该表达式返回“应用于”列表中的对象之一。
以下示例创建一个组织结构图,并向图示根节点中添加子节点。
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