FirstChild Property

Microsoft PowerPoint Visual Basic

FirstChild Property

       

Returns a DiagramNode object representing the first diagram node in a collection of diagram nodes.

expression.FirstChild

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

Example

The following example creates a new diagram and identifies the first child diagram node.

Sub FirstChildNodeHello()

    Dim dgnNode As DiagramNode
    Dim dgnFirst As DiagramNode
    Dim shpDiagram As Shape
    Dim intNodes As Integer
           
    Set shpDiagram = ActivePresentation.Slides(1).Shapes.AddDiagram _
        (Type:=msoDiagramOrgChart, Left:=10, Top:=15, _
        Width:=400, Height:=475)
    Set dg nNode = shpDiagram.DiagramNode.Children.AddNode
   
    For intNodes = 1 To 3
        dg nNode.Children.AddNode
    Next intNodes
   
    Set dgnFirst = dg nNode.Children.FirstChild
    dgnFirst.Shape.TextFrame.TextRange.Text = "Here I am!"

End Sub