AutoFormat Property

Microsoft PowerPoint Visual Basic

Show All

AutoFormat Property

       

Sets or returns an MsoTriState constant that represents a diagram's automatic formatting state. Read/write.

MsoTriState can be one of these MsoTriState constants.
msoCTrue Doesn't apply to this property.
msoFalse Automatic formatting is not enabled.
msoTriStateMixed Doesn't apply to this property.
msoTriStateToggle Doesn't apply to this property.
msoTrue Automatic formatting is enabled.

expression.AutoFormat

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

Example

The following example creates a diagram, and enables automatic formatting.

Sub ConvertPyramidDiagram()

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

    'Adds pyramid diagram and first child node
    Set shpDiagram = ActivePresentation.Slides(1).Shapes _
        .AddDiagram(Type:=msoDiagramPyramid, Left:=10, _
        Top:=15, Width:=400, Height:=475)
    Set dgnNode = shpDiagram.DiagramNode.Children.AddNode

    'Adds three additional nodes
    For intNodes = 1 To 3
        dgnNode.AddNode
    Next intNodes

    'Automatically formats the diagram nodes and
    'converts pyramid diagram to radial diagram
    With dgnNode.Diagram
        .AutoFormat = msoTrue
        .Convert Type:=msoDiagramRadial
    End With

End Sub