InlineShapes.AddChart2 Method (Word)

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 an InlineShape object that represents the chart and adds it to the specified collection.

expression .AddChart2(Style,Type,Range,NewLayout)

expression A variable that represents a InlineShapes object.

Parameters

Name

Required/Optional

Data type

Description

Style

Optional

INT32

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

Type

Optional

XLCHARTTYPE

The type of chart.

Range

Optional

VARIANT

The range where the chart will be placed in the text. The chart replaces the range, unless the range is collapsed. If this argument is omitted, the chart is placed automatically.

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).

Type

Optional

XLCHARTTYPE

Return value

INLINESHAPE

Show: