Classe CategoryCollection - collection de catégories (Word VBA)
La classe CategoryCollection représente la collection de catégories de graphique visible dans le document. Pour utiliser une variable de classe CategoryCollection, elle doit d'abord être instanciée, par exemple
Dim ccn as CategoryCollection
Set ccn = ActiveDocument.Background.Chart.ChartGroups(1).CategoryCollection()
For Each
Voici un exemple de traitement des éléments CategoryCollection dans une collection
Dim chrcCategoryCollection As ChartCategory
For Each chrcCategoryCollection In ActiveDocument.Background.Chart.ChartGroups(1).CategoryCollection()
Next chrcCategoryCollection
Count
Renvoie un type long qui représente le nombre de catégories dans la collection.
Dim lngCount As Long
lngCount = ActiveDocument.Background.Chart.ChartGroups(1).CategoryCollection.Count
Item
Renvoie une catégorie de graphique individuelle.
Item (Index)
Index: Nom ou numéro d'index de l'objet.
Dim chrcCategoryCollection As ChartCategory
Set chrcCategoryCollection = ActiveDocument.Background.Chart.ChartGroups(1).CategoryCollection(Index:=1)