Diagram Property

Microsoft Word Visual Basic

Diagram Property

       

Returns a Diagram object to which a diagram node belongs.

expression.Diagram

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

Example

This example converts a pyramid diagram into a radial diagram.

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

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

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

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

    With dgnNode.Diagram
        'Turn on automatic formatting
        .AutoFormat = msoTrue

        'Convert pyramid diagram into a radial diagram
        .Convert Type:=msoDiagramRadial
    End With
End Sub