Share via


DiagramNodeChildren.LastChild Property

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

expression.LastChild

Example

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

  Sub LastChildNodeHello()
    Dim shpDiagram As Shape
    Dim dgnNode As DiagramNode
    Dim dgnLast As DiagramNode
    Dim intNodes As Integer
    'Add org chart to first slide and first child node
    Set shpDiagram = ActivePresentation.Slides(1).Shapes.AddDiagram _
        (Type:=msoDiagramOrgChart, Left:=10, Top:=15, _
        Width:=400, Height:=475)
    Set dgnNode = shpDiagram.DiagramNode.Children.AddNode
    'Add three additional nodes
    For intNodes = 1 To 3
        dgnNode.Children.AddNode
    Next intNodes
    'Enter text into last child node
    Set dgnLast = dgnNode.Children.LastChild
    dgnLast.Shape.TextFrame.TextRange.Text = "Here I am!"
End Sub

Applies to | DiagramNodeChildren Collection