Propiedad XMLNode.FirstChild (Word)

Devuelve un objeto DiagramNode que representa el primer nodo secundario de un nodo primario. Solo lectura.

Sintaxis

expresión. FirstChild

expresión obligatoria. Variable que representa un objeto 'XMLNode'.

Comentarios

Utilice la propiedad LastChild para obtener acceso al último nodo secundario. Utilice la propiedad Root para obtener acceso al nodo primario de un diagrama.

Ejemplo:

En este ejemplo, se agrega un organigrama al documento actual, se agregan tres nodos y se asignan el primer y último nodo secundario a 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

Consulte también

Objeto XMLNode

Soporte técnico y comentarios

¿Tiene preguntas o comentarios sobre VBA para Office o esta documentación? Vea Soporte técnico y comentarios sobre VBA para Office para obtener ayuda sobre las formas en las que puede recibir soporte técnico y enviar comentarios.