InlineShapes.AddChart Method

Word Developer Reference

Inserts a chart, of the specified type, as an inline 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, Range)

expression   An expression that returns an InlineShapes object.

Parameters

Name Required/Optional Data Type Description
Type Optional XlChartType Specifies the type of chart to create.
Range Optional Variant Specifies the text to which the chart is bound. If Range is specified, the chart is positioned at the beginning of the first paragraph in the range. If this argument is omitted, the range is selected automatically, and the chart is positioned relative to the top and left edges of the page.

Return Value
InlineShape

Example

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

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

See Also