Reverse Property

Microsoft Excel Visual Basic

MsoTriState can be one of these MsoTriState constants.
msoCTrue Not used with this property.
msoFalse Leaves the diagram nodes as they are.
msoTriStateMixed Not used with this property.
msoTriStateToggle Not used with this property.
msoTrue Reverses the nodes in a diagram.

expression.Reverse

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

Example

The following example creates a pyramid diagram, and reverses the nodes so that the node that was on the bottom of the pyramid is on the top, and the node that was on the top is on the bottom.

Sub CreatePyramidDiagram()

    Dim shpDiagram As Shape
    Dim dgnNode As DiagramNode
    Dim intCount As Integer

    'Add pyramid diagram to the current document
    Set shpDiagram = ActiveSheet.Shapes.AddDiagram( _
        Type:=msoDiagramPyramid, Left:=10, _
        Top:=15, Width:=400, Height:=475)

    'Add first child node to the diagram
    Set dgnNode = shpDiagram.DiagramNode.Children.AddNode

    'Add three child nodes
    For intCount = 1 To 3
        dgnNode.AddNode
    Next intCount

    With dgnNode.Diagram

        'Enable automatic formatting
        .AutoFormat = msoTrue

        'Reverse the order of the nodes
        .Reverse = msoTrue
    End With

End Sub