TransferChildren 方法

       

将一个图示节点的子节点移动到另一个图示节点。

expression.TransferChildren(ReceivingNode)

expression  必选。该表达式返回“应用于”列表中的对象之一。

ReceivingNode  必选。DiagramNode 对象。目标(接收的)图示节点。

示例

以下示例将新建图示中第一个节点的子节点传送到第三个节点。

Sub TransferChildNodes()

    Dim dgnNode As DiagramNode
    Dim shpDiagram As Shape
    Dim intNodes As Integer

    'Adds org chart and root node
    Set shpDiagram = ActivePresentation.Slides(1).Shapes _
        .AddDiagram(Type:=msoDiagramOrgChart, Left:=10, _
        Top:=15, Width:=400, Height:=475)
    Set dgnNode = shpDiagram.DiagramNode.Children.AddNode

    'Adds three child nodes to root node
    For intNodes = 1 To 3
        dgnNode.Children.AddNode
    Next intNodes

    'Adds three child nodes to first child node
    For intNodes = 1 To 3
        dgnNode.Children.Item(1).Children.AddNode
    Next intNodes

    ' Transfers children of the first node to the third node
    dgnNode.Children.Item(1).TransferChildren _
        ReceivingNode:=dgnNode.Children.Item(3)

End Sub