Shapes.AddChart Method
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.
Namespace: Microsoft.Office.Interop.Word
Assembly: Microsoft.Office.Interop.Word (in Microsoft.Office.Interop.Word.dll)
Syntax
'Declaration
Function AddChart ( _
Type As XlChartType, _
ByRef Left As Object, _
ByRef Top As Object, _
ByRef Width As Object, _
ByRef Height As Object, _
ByRef Anchor As Object _
) As Shape
'Usage
Dim instance As Shapes
Dim Type As XlChartType
Dim Left As Object
Dim Top As Object
Dim Width As Object
Dim Height As Object
Dim Anchor As Object
Dim returnValue As Shape
returnValue = instance.AddChart(Type, _
Left, Top, Width, Height, Anchor)
Shape AddChart(
XlChartType Type,
ref Object Left,
ref Object Top,
ref Object Width,
ref Object Height,
ref Object Anchor
)
Parameters
- Type
Type: XlChartType
Specifies the type of chart to create.
- Left
Type: System.Object%
The position, measured in points, of the left edge of the chart relative to the anchor.
- Top
Type: System.Object%
The position, measured in points, of the top edge of the chart relative to the anchor.
- Width
Type: System.Object%
The width, measured in points, of the chart.
- Height
Type: System.Object%
The height, measured in points, of the chart.
- Anchor
Type: System.Object%
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
Type: Microsoft.Office.Interop.Word.Shape
Shape
Examples
Creates a new 3-D column chart and adds it to the active document.