返回一个 Diagram 对象,该对象包含图表顶点。
expression.Diagram
expression 必需。该表达式返回“应用于”列表中的一个对象。
本示例将一个棱锥图表转换为放射图表。
Sub CreatePyramidDiagram()
Dim dgnNode As DiagramNode
Dim shpDiagram As Shape
Dim intCount As Integer
'Add diagram to current document
Set shpDiagram = ThisDocument.Shapes.AddDiagram _
(Type:=msoDiagramPyramid, Left:=10, _
Top:=15, Width:=400, Height:=475)
'Add first child node
Set dgnNode = shpDiagram.DiagramNode.Children.AddNode
'Add three more child nodes
For intCount = 1 To 3
dgnNode.AddNode
Next intCount
With dgnNode.Diagram
'Turn on automatic formatting
.AutoFormat = msoTrue
'Convert pyramid diagram into a radial diagram
.Convert Type:=msoDiagramRadial
End With
End Sub