SeriesCollection.Add Method (PowerPoint)
Adds one or more new series to the collection.
Version Information
Version Added: PowerPoint 2007
Syntax
expression .Add(Source, Rowcol, SeriesLabels, CategoryLabels, Replace)
expression A variable that represents a SeriesCollection object.
Parameters
Name |
Required/Optional |
Data Type |
Description |
---|---|---|---|
Source |
Required |
Variant |
The new data as a string representation of a range contained in the Workbook property of the ChartData object for the chart. |
Rowcol |
Optional |
One of the enumeration values that specifies whether the new values are in the rows or columns of the specified range. |
|
SeriesLabels |
Optional |
Variant |
True if the first row or column contains the name of the data series. False if the first row or column contains the first data point of the series. If this argument is omitted, Microsoft Word attempts to determine the location of the series name from the contents of the first row or column. |
CategoryLabels |
Optional |
Variant |
True if the first row or column contains the name of the category labels. False if the first row or column contains the first data point of the series. If this argument is omitted, Word attempts to determine the location of the category label from the contents of the first row or column. |
Replace |
Optional |
Variant |
If CategoryLabels is True and Replace is True, the specified categories replace the categories that currently exist for the series. If Replace is False, the existing categories will not be replaced. The default is False. |
Return Value
A Series object that represents the new series.
Remarks
This method does not actually return a Series object as stated in the Object Browser.
Example
Note
Although the following code applies to Microsoft Word, you can readily modify it to apply to PowerPoint.
The following example creates a new series for the first chart in the active document. The data source for the new series is range B1:B10 on the workbook associated with the chart.
With ActiveDocument.InlineShapes(1)
If .HasChart Then
.Chart.SeriesCollection.Add _
Source:="Sheet1!B1:B10"
End If
End With