Class Categories (Word VBA)

The class Categories represents a collection of building block categories. To use a Categories class variable it first needs to be instantiated, for example


Dim ctgs as Categories
Set ctgs = CustomizationContext.BuildingBlockTypes(1).Categories

For Each

Here is an example of processing the Categories items in a collection.


Dim ctg As Category
For Each ctg In CustomizationContext.BuildingBlockEntries.Categories
	
Next ctg

Count

Returns the number of items in the Categories collection.


Dim lngCount As Long
lngCount = CustomizationContext.BuildingBlockTypes(1).Categories.Count

Item

Returns a Category object that represents the specified item in the collection.

Item (Index)

Index: Specifies a String or Integer that represents the name or ordinal position of the object in the collection.


Dim ctg As Category
Set ctg = CustomizationContext.BuildingBlockTypes(1).Categories(Index:=1)