Presentation.Convert Method

PowerPoint Developer Reference

Converts a diagram to a different diagram type.

Syntax

expression.Convert(Type)

expression   A variable that represents a Presentation object.

Parameters

Name Required/Optional Data Type Description
Type Required MsoDiagramType The type of diagram to convert to.

Remarks

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

The

Type

parameter value can be one of these MsoDiagramType constants.

msoDiagramCycle
msoDiagramMixed
msoDiagramOrgChart
msoDiagramPyramid
msoDiagramRadial
msoDiagramTarget
msoDiagramVenn

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

Visual Basic for Applications
  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
    .<strong>Convert</strong>  Type:=msoDiagramRadial
End With

End Sub

See Also