Class SeriesCollection (PowerPoint VBA)
The class SeriesCollection represents a collection of all the Series objects in the specified chart or chart group. To use a SeriesCollection class variable it first needs to be instantiated, for example
Dim scn as SeriesCollection
Set scn = ActiveWindow.RangeFromPoint.Chart.ChartGroups(1).SeriesCollection()
Add
Adds one or more new series to the collection.
This method does not actually return a Series object as stated in the Object Browser.
Add (Source, Rowcol, SeriesLabels, CategoryLabels, Replace)
Dim srs As Series
Set srs = ActivePresentation.Slides(1).Shapes(1).Chart.ChartGroups(1).SeriesCollection.Add(Source:=)
Arguments
The following argument is required
Source (ChartData) - The new data as a string representation of a range contained in the Workbook property of the ChartData object for the chart.
Optional arguments
The following arguments are optional
Rowcol (XlRowCol) - One of the enumeration values that specifies whether the new values are in the rows or columns of the specified range.
Possible return values are xlColumns - The data series is in a row, xlRows - The data series is in a column.
SeriesLabels (Boolean) - 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 (Boolean) - 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 (Boolean) - 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.
Count
Returns the number of objects in the collection.
Dim lngCount As Long
lngCount = ActiveWindow.RangeFromPoint.Chart.ChartGroups(1).SeriesCollection.Count
Extend
Adds new data points to an existing series collection.
This method is not available for PivotChart reports.
Extend (Source, Rowcol, CategoryLabels)
ActivePresentation.Slides(1).Shapes(1).Chart.ChartGroups(1).SeriesCollection.Extend Source:= "B1:B6"
Arguments
The following argument is required
Source (SeriesCollection) - The new data to be added to the SeriesCollection object, represented as an A1-style range reference.
Optional arguments
The following arguments are optional
Rowcol (XlRowCol) - One of the XlRowCol enumeration values that specifies whether the new values are in the rows or columns of the given range source. If this argument is omitted, Microsoft Word attempts to determine where the values are by the size and orientation of the selected range or by the dimensions of the array.
Possible return values are xlColumns - The data series is in a row, xlRows - The data series is in a column.
CategoryLabels (Boolean) - True to have the first row or column contain the name of the category labels. False to have the first row or column contain 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.
Item
Returns a single Series object from the collection.
Item (Index)
Index: The name or index number for the object.
Dim srsSeriesCollection As Series
Set srsSeriesCollection = ActivePresentation.Slides(1).Shapes(1).Chart.ChartGroups(1).SeriesCollection(Index:=1)
NewSeries
Creates a new series.
This method is not available for PivotChart charts.
Dim srsNewSeries As Series
Set srsNewSeries = ActivePresentation.Slides(1).Shapes(1).Chart.ChartGroups(1).SeriesCollection.NewSeries()