Shapes.AddChart Method (Word)
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 Word uses to create the chart.
Syntax
expression .AddChart(Type, Left, Top, Width, Height, Anchor)
expression An expression that returns a Shapes object.
Parameters
Name |
Required/Optional |
Data Type |
Description |
---|---|---|---|
Type |
Optional |
XlChartType |
Specifies the type of chart to create. |
Left |
Optional |
Variant |
The position, measured in points, of the left edge of the chart relative to the anchor. |
Top |
Optional |
Variant |
The position, measured in points, of the top edge of the chart relative to the anchor. |
Width |
Optional |
Variant |
The width, measured in points, of the chart. |
Height |
Optional |
Variant |
The height, measured in points, of the chart. |
Anchor |
Optional |
Variant |
A 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
Example
Creates a new 3-D column chart and adds it to the active document.
ActiveDocument.Shapes.AddChart Type:=xl3DColumn