Chart.SetSourceData method (PowerPoint)
Sets the source data range for the chart.
expression. SetSourceData
( _Source_
, _PlotBy_
)
expression A variable that represents a Chart object.
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. |
Note
Although the following code applies to Microsoft Word, you can readily modify it to apply to PowerPoint.
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
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.