AddDiagram Method

Returns a Shape object that represents a diagram added to a slide, slide master, or slide range.

expression.AddDiagram(Type, Left, Top, Width, Height)

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

MsoDiagramType

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 Show foundation-based relationships.
msoDiagramRadial Shows relationships of a core element.
msoDiagramTarget Shows steps toward a goal.
msoDiagramVenn Shows areas of overlap between elements.

Left   Required Single. The position, measured in points, of the left edge of the diagram canvas's bounding box, relative to the left edge of the page.

Top   Required Single. The position, measured in points, of the top edge of the diagram canvas's bounding box, relative to the top edge of the page.

Width   Required Single. The width, measured in points, of the diagram canvas's bounding box.

Height   Required Single. The height, measured in points, of the diagram canvas's bounding box.

Example

The following example adds a pyramid diagram with four nodes to the first slide in the active presentation.

Sub CreatePyramidDiagram()

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

    'Adds pyramid diagram 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 more child nodes to pyramid diagram
    For intNodes = 1 To 3
        dgnNode.AddNode
    Next intNodes

End Sub

Applies to | Shapes Collection Object