BuildingBlocks Object (Word)
Represents a collection of BuildingBlock objects for a specific building block type and category in a template.
Use the Add method to create a new building block and add it to a template. The following example adds the selected text to the watermarks building block gallery of the first template in the Templates collection.
Dim objTemplate As Template Dim objBB As BuildingBlock Set objTemplate = Templates(1) Set objBB = objTemplate.BuildingBlockEntries _ .Add(Name:="New Building Block Entry", _ Type:=wdTypeWatermarks, _ Category:="General", _ Range:=Selection.Range)
The collection returned with the BuildingBlocks collection is a filtered collection based on the type and category. Depending on how you access the collection, the collection returned changes. For example, if you access a collection of building blocks with a type of wdTypeAutoText with a category of "General", the returned collection may be different from the collection returned if you access a collection of building blocks with a type of wdTypeAutoText with a category of "Custom". It is also different from the collection returned if you access the collection of building blocks with a type of wdTypeCustomAutoText with a category of "General".
For more information about building blocks, see Working with Building Blocks.