Chart.SetSourceData Method (Word)
Sets the source data range for the chart.
Version Information
Version Added: Word 2007
Syntax
expression .SetSourceData(Source, PlotBy)
expression A variable that represents a Chart object.
Parameters
Name |
Required/Optional |
Data Type |
Description |
---|---|---|---|
Source |
Required |
String |
The address of the chart data range that contains the source data. |
PlotBy |
Optional |
Variant |
Specifies the way the data will be plotted. Can be either of the following XlRowCol constants: xlColumns or xlRows. |
Example
The following example sets the source data range for the first chart in the active document.
With ActiveDocument.InlineShapes(1)
If .HasChart Then
.Chart.SetSourceData _
Source:="='Sheet1'!$A$1:$D$5", _
PlotBy:=xlColumns
End If
End With