Convert Method

Microsoft Word Visual Basic

Show All

Convert Method

       

Convert method as it applies to the Diagram object.

Converts a diagram of one type into a diagram of another type.

expression.Convert(Type)

expression   Required. An expression that returns a Diagram object.

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

MsoDiagramType can be one of these MsoDiagramType constants.
msoDiagramCycle  Shows a process with a continuous cycle.
msoDiagramMixed  Not used with this method.
msoDiagramOrgChart  Shows hierarchical relationships.
msoDiagramPyramid  Shows foundation-based relationships.
msoDiagramRadial  Shows relationships of a core element.
msoDiagramTarget  Shows steps toward a goal.
msoDiagramVenn  Shows areas of overlap between elements.

Convert method as it applies to the Endnotes and Footnotes objects.

Converts endnotes to footnotes, or vice versa.

expression.Convert

expression   Required. An expression that returns one of the above objects.

Convert method as it applies to the ListTemplate object.

Converts a multiple-level list to a single-level list, or vice versa.

expression.Convert(Level)

expression   Required. An expression that returns a ListTemplate object.

Level  Optional Variant. The level to use for formatting the new list. When converting a multiple-level list to a single-level list, this argument can be a number from 1 through 9. When converting a single-level list to a multiple-level list, 1 is the only valid value. If this argument is omitted, 1 is the default value.

Remarks

You cannot use the Convert method on a list template that is derived from the ListGalleries collection.

Example

As it applies to the Diagram object.

This example creates a pyramid diagram and then converts it into a radial diagram.

Sub CreatePyramidDiagram()
    Dim dgnNode As DiagramNode
    Dim shpDiagram As Shape
    Dim intCount As Integer

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

    'Add four child nodes to the diagram
    Set dgnNode = shpDiagram.DiagramNode.Children.AddNode
    For intCount = 1 To 3
        dgnNode.AddNode
    Next intCount

    With dgnNode.Diagram

        'Automatically formats the diagram
        .AutoFormat = msoTrue

        'Converts the diagram from a pyramid to a radial diagram
        .Convert Type:=msoDiagramRadial
    End With

End Sub

As it applies to the Endnotes object.

This example converts all endnotes in the active document to footnotes.

Set endDocEndnotes = ActiveDocument.Endnotes
If endDocEndnotes.Count > 0 Then myEndnotes.Convert

As it applies to the Footnotes object.

This example converts the footnotes in the selection to endnotes.

If Selection.Footnotes.Count > 0 Then Selection.Footnotes.Convert

As it applies to the ListTemplate object.

This example converts the first list template in the active document. If the list template is multiple-level, it becomes single-level, or vice versa.

ActiveDocument.ListTemplates(1).Convert