Add Method (ChartObjects Collection)

Applies To

ChartObjects collection object.

Description

Creates a new embedded chart. Returns a ChartObject object.

Syntax

object.Add(Left, Top, Width, Height)

object Required. An expression that returns a ChartObjects object.

Left, Top Required Long. The initial coordinates of the new object (in points), relative to the upper-left corner of cell A1 on a worksheet or to the upper-left corner of a chart.

Width, Height Required Long. The initial size of the new object, in points.

Example

This example creates a new embedded chart.

Set co = Sheets("Sheet1").ChartObjects.Add(50, 40, 200, 100)
co.Chart..ChartWizard Source:=Worksheets("Sheet1").Range("A1:B2"), _
    Gallery:=xlColumn, Format:=6, PlotBy:=xlColumns, _
    CategoryLabels:=1, SeriesLabels:=0, HasLegend:=1