TextShape Property

Microsoft PowerPoint Visual Basic

object representing the shape of the text box associated with a diagram node.

expression.TextShape

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

Example

The following example adds child nodes to a parent node, and displays text in the parent node indicating the number of child nodes created.

Sub CountChildNodes()

    Dim dgnNode As DiagramNode
    Dim shpDiagram As Shape
    Dim intNodes As Integer
    Dim shpText As Shape

    'Adds diagram and first node to first slide
    Set shpDiagram = ActivePresentation.Slides(1).Shapes _
        .AddDiagram(Type:=msoDiagramRadial, Left:=200, Top:=75, _
        Width:=300, Height:=475)
    Set dgnNode = shpDiagram.DiagramNode.Children.AddNode

    'Adds three child nodes to first node
    For intNodes = 1 To 3
        dgnNode.Children.AddNode
    Next intNodes

    'Enters node number into each child node
    For intNodes = 1 To dgnNode.Children.Count
        Set shpText = shpDiagram.DiagramNode.Children(1) _
            .Children(intNodes).TextShape
        shpText.TextFrame.TextRange.Text = CStr(intNodes)
    Next intNodes

End Sub