TransferChildren Method

Microsoft PowerPoint Visual Basic

expression.TransferChildren(ReceivingNode)

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

ReceivingNode   Required DiagramNode object. The target (receiving) diagram node.

Example

The following example transfers the child nodes from the first node to the third node of a newly-created diagram.

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