Table of contents
TOC
Collapse the table of content
Expand the table of content

Chart.SetSourceData Method (PowerPoint)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

Sets the source data range for the chart.

Syntax

expression. SetSourceData( Source, PlotBy )

expression A variable that represents a Chart object.

Parameters

NameRequired/OptionalData TypeDescription
SourceRequiredStringThe address of the chart data range that contains the source data.
PlotByOptionalVariantSpecifies the way the data will be plotted. Can be either of the following XlRowCol constants: xlColumns or xlRows.

Example

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

See also

Concepts

Chart Object

© 2018 Microsoft