Convert Method

Microsoft PowerPoint Visual Basic

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
msoDiagramMixed
msoDiagramOrgChart
msoDiagramPyramid
msoDiagramRadial
msoDiagramTarget
msoDiagramVenn

Remarks

This method generates an error if the value of the target diagram's Type property is an organization chart (msoDiagramTypeOrgChart).

Example

The following example adds a pyramid diagram to a slide and converts it to a radial diagram.

Sub ConvertPyramidDiagram()

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

    'Adds pryamid diagra 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 child nodes
    For intNodes = 1 To 3
        dgnNode.AddNode
    Next intNodes

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

End Sub