AutoLayout Property

Microsoft PowerPoint Visual Basic

Show All

AutoLayout Property

       

Sets or returns an MsoTriState constant that represents whether a diagram's components are automatically laid out. Read/write.

MsoTriState can be one of these MsoTriState constants.
msoCTrue Doesn't apply to this property.
msoFalse The diagram's components are not automatically laid out.
msoTriStateMixed Doesn't apply to this property.
msoTriStateToggle Doesn't apply to this property.
msoTrue The diagram's components are automatically laid out.

expression.AutoLayout

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

Example

The following example adds a diagram to a slide, converts it to a radial diagram, and arranges the diagram's nodes automatically.

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 places the diagram nodes and
    'converts pyramid diagram to radial diagram
    With dgnNode.Diagram
        .AutoLayout = msoTrue
        .Convert Type:=msoDiagramRadial
    End With

End Sub