This documentation is archived and is not being maintained.

Shapes.AddChart Method

Office 2007
Inserts a chart, of the specified type, as a shape into the active document, and opens Microsoft Office Excel with a sheet that contains the default data that Microsoft Office Word uses to create the chart.

Syntax

expression.AddChart(Type, Left, Top, Width, Height, Anchor)

expression   An expression that returns a Shapes object.

Parameters

NameRequired/OptionalData TypeDescription
TypeOptionalXlChartTypeSpecifies the type of chart to create.
LeftOptionalVariantThe position, measured in points, of the left edge of the chart relative to the anchor.
TopOptionalVariantThe position, measured in points, of the top edge of the chart relative to the anchor.
WidthOptionalVariantThe width, measured in points, of the chart.
HeightOptionalVariantThe height, measured in points, of the chart.
AnchorOptionalVariantA Range object that represents the text to which the chart is bound. If Anchor is specified, the anchor is positioned at the beginning of the first paragraph in the anchoring range. If this argument is omitted, the anchoring range is selected automatically and the chart is positioned relative to the top and left edges of the page.

Return Value
Shape

Example

Creates a new 3-D column chart and adds it to the active document.

Visual Basic for Applications
ActiveDocument.Shapes.AddChart Type:=xl3DColumn



Show: