AutoFormat Property

Microsoft Word Visual Basic

constant specifying the automatic formatting state for a diagram. Read/write.

MsoTriState can be one of these MsoTriState constants.
msoCTrue Not used for this property.
msoFalse Disables automatic formatting.
msoTriStateMixed Not used for this property.
msoTriStateToggle Not used for this property.
msoTrue Formats a diagram to format automatically.

expression.AutoFormat

expression    Required. An expression that returns a Diagram object.

Example

This example creates a diagram in the current document and turns on automatic formatting for the diagram.

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

    'Add a pyramid diagram to current document and first child node
    Set shpDiagram = ThisDocument.Shapes.AddDiagram _
        (Type:=msoDiagramPyramid, Left:=10, _
        Top:=15, Width:=400, Height:=475)
    Set dgnNode = shpDiagram.DiagramNode.Children.AddNode

    'Add three child node
    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