Class CategoryCollection (Word VBA)
The class CategoryCollection represents the collection of visible chart categories in the document. To use a CategoryCollection class variable it first needs to be instantiated, for example
Dim ccn as CategoryCollection
Set ccn = ActiveDocument.Background.Chart.ChartGroups(1).CategoryCollection()
For Each
Here is an example of processing the CategoryCollection items in a collection.
Dim chrcCategoryCollection As ChartCategory
For Each chrcCategoryCollection In ActiveDocument.Background.Chart.ChartGroups(1).CategoryCollection()
Next chrcCategoryCollection
Count
Returns a Long that represents the number of categories in the collection.
Dim lngCount As Long
lngCount = ActiveDocument.Background.Chart.ChartGroups(1).CategoryCollection.Count
Item
Returns an individual chart category.
Item (Index)
Index: The name or index number for the object.
Dim chrcCategoryCollection As ChartCategory
Set chrcCategoryCollection = ActiveDocument.Background.Chart.ChartGroups(1).CategoryCollection(Index:=1)