TransferChildren Method
From Microsoft Word Visual Basic
TransferChildren Method
Moves the child nodes of the source diagram node to the target (receiving) diagram node.
expression.TransferChildren(ReceivingNode)
expression Required. An expression that returns a DiagramNode object.
ReceivingNode Required DiagramNode object. The node to which to transfer the child nodes.
Example
The following example transfers the child nodes of a newly-created diagram from one node to another.
Sub TransferChildNodes()
Dim dgnNode As DiagramNode
Dim shpDiagram As Shape
Dim intCount As Integer
'Add organizational chart to current document
Set shpDiagram = ThisDocument.Shapes.AddDiagram _
(Type:=msoDiagramOrgChart, Left:=10, _
Top:=15, Width:=400, Height:=475)
'Add first node to organizational chart
Set dgnNode = shpDiagram.DiagramNode.Children.AddNode
'Add three child nodes to first node
For intCount = 1 To 3
dgnNode.Children.AddNode
Next intCount
'Add three child nodes to the first child node
'of the first node
For intCount = 1 To 3
dgnNode.Children.Item(1).Children.AddNode
Next intCount
'Move the child nodes of the first child node
'so they become child nodes of the third child node
dgnNode.Children.Item(1).TransferChildren _
ReceivingNode:=dgnNode.Children.Item(3)
End Sub