Shapes.AddChart2 Method (Excel)

Office 2013 and later
GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Adds a chart to the document. Returns a Shape object that represents a chart and adds it to the specified collection.

expression .AddChart2(Style,XlChartType,Left,Top,Width,Height,NewLayout)

expression A variable that represents a Shapes object.

Parameters

Name

Required/Optional

Data type

Description

Style

Optional

VARIANT

The chart style. Use "-1" to get the default style for the chart type specified in XlChartType.

XlChartType

Optional

VARIANT

The type of chart.

Left

Optional

VARIANT

The position, in points, of the left edge of the chart, relative to the anchor.

Top

Optional

VARIANT

The position, in points, of the top edge of the chart, relative to the anchor.

Width

Optional

VARIANT

The width, in points, of the chart.

Height

Optional

VARIANT

The height, in points, of the chart.

NewLayout

Optional

VARIANT

If NewLayout is True, the chart is inserted by using the new dynamic formatting rules (Title is on, and Legend is on only if there are multiple series).

Name

Required/Optional

Data type

Description

Return value

SHAPE

Concepts

Other resources

Show:
© 2016 Microsoft