Share via


LastChild Property

LastChild Property
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

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

expression.LastChild

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 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