全部显示

AutoFormat 属性

       

设置或返回一个 MsoTriState 常量,该常量指示图表的自动格式设置状态。可读写。

expression.AutoFormat

expression   必需。该表达式返回“应用于”列表中的对象之一。

示例

本示例在当前文档中创建一个图表,并打开该图表的自动格式设置。

Sub CreatePyramidDiagram()
    Dim dgnNode As DiagramNode
    Dim shpDiagram As Shape
    Dim intCount As Integer

    'Add a pyramid diagram to current document
    Set shpDiagram = ActiveSheet.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

    'Enable automatic formatting for the diagram and convert
    'it to a radial diagram
    With dgnNode.Diagram
        .AutoFormat = msoTrue
        .Convert Type:=msoDiagramRadial
    End With

End Sub