返回 Shape 对象,该对象代表与图示节点相关联的文本框的形状。
expression.TextShape
expression 必选。该表达式返回“应用于”列表中的对象之一。
以下示例向一个父节点添加子节点,并在每个子节点中显示创建其的编号。
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