Convert Method

Microsoft Excel Visual Basic

Show All

Convert Method

       

Converts the current diagram to a different diagram.

expression.Convert(Type)

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

Type  Required MsoDiagramType. The type of diagram to convert to.

MsoDiagramType can be one of these MsoDiagramType constants.
msoDiagramCycle  A process diagram with a continuous cycle diagram type.
msoDiagramMixed  A mixed diagram type.
msoDiagramOrgChart  A hierarchical relationship diagram type.
msoDiagramPyramid  A foundation based relationships diagram type.
msoDiagramRadial  A diagram type showing relationships of a core element.
msoDiagramTarget A diagram type showing steps toward a goal.
msoDiagramVenn  A diagram type showing areas of overlap between elements.

Example

This example adds a radial diagram to the active worksheet and then converts it to a target diagram.

Sub ConvertDiagram()

    Dim wksSheet As Worksheet
    Dim shDiagram As Shape

    Set wksSheet = ActiveSheet
    Set shDiagram = wksSheet.Shapes.AddDiagram( _
        Type:=msoDiagramRadial, _
        Left:=20, Top:=40, _
        Width:=400, Height:=200)

    ' Fill the diagram to make it visible to the user
    shDiagram.Fill.Visible = msoTrue

    ' Convert the diagram.
    shDiagram.Diagram.Convert Type:=msoDiagramTarget

End Sub