XMLNode.FirstChild property (Word)
Returns a DiagramNode object that represents the first child node of a parent node. Read-only.
Syntax
expression. FirstChild
expression Required. A variable that represents a 'XMLNode' object.
Remarks
Use the LastChild property to access the last child node. Use the Root property to access the parent node in a diagram.
Example
This example adds an organization chart diagram to the current document, adds three nodes, and assigns the first and last child nodes to variables.
Sub FirstChild()
Dim shpDiagram As Shape
Dim dgnRoot As DiagramNode
Dim dgnFirstChild As DiagramNode
Dim dgnLastChild As DiagramNode
Dim intCount As Integer
'Add organizational chart diagram to the current document
Set shpDiagram = ActiveDocument.Shapes.AddDiagram _
(Type:=msoDiagramOrgChart, Left:=10, _
Top:=15, Width:=400, Height:=475)
'Add the first node to the diagram
Set dgnRoot = shpDiagram.DiagramNode.Children.AddNode
'Add three child nodes
For intCount = 1 To 3
dgnRoot.Children.AddNode
Next intCount
'Assign the first and last child nodes to variables
Set dgnFirstChild = dgnRoot.Children.FirstChild
Set dgnLastChild = dgnRoot.Children.LastChild
End Sub
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for