BuildingBlockEntries Collection

Word Developer Reference

Represents a collection of all BuildingBlock objects in a template.

Version Information
 Version Added:  Word 2007

Remarks

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.

Visual Basic for Applications
  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)

Unlike the Add method for the BuildingBlocks collection, you need to specify the type and category when you add a building block using the Add method of the BuildingBlockEntries collection. This is because building blocks are organized by using types and categories. When you use the BuildingBlockEntries collection, you are accessing the entire collection of building blocks in a template; however, when you use the BuildingBlocks collection, you are accessing the collection of building blocks for a specific type and category in a template.

Bb256535.vs_note(en-us,office.12).gif  Note
Using the Category and Type properties for the BuildingBlock object enables you to determine the category and type for a building block.

For more information about building blocks, see Working with Building Blocks.

See Also