返回一个代表图表的 Diagram 对象。
expression.Diagram
expression 必需。该表达式返回“应用于”列表中的对象之一。
本示例向活动工作表中添加组织结构图图表。然后,Microsoft Excel 显示关于添加到图表中的节点数的消息。
Sub UseDiagram()
    Dim wksOne As Worksheet
    Set wksOne = ActiveSheet
    ActiveSheet.Shapes.AddDiagram( _
        Type:=msoDiagramOrgChart, Top:=10, _
        Left:=15, Width:=400, Height:=475)
    'Notify user the number of nodes added to the diagram.
    MsgBox wksOne.Shapes(1).Diagram.Nodes.Count
End Sub