BuildingBlockEntries.Add method (Word)
Creates a new building block entry in a template and returns a BuildingBlock object that represents the new building block entry.
Syntax
expression.Add (Name, Type, Category, Range, Description, InsertOptions)
expression An expression that returns a 'BuildingBlockEntries' object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
Name | Required | String | Specifies the name of the building block entry. Corresponds to the Name property of the BuildingBlock object. |
Type | Required | WdBuildingBlockTypes | Specifies the type of building block to create. Corresponds to the Type property of the BuildingBlock object. |
Category | Required | String | Specifies the category of the new building block entry. Corresponds to the Category property of the BuildingBlock object. |
Range | Required | Range | Specifies the value of the buildling block entry. Corresponds to the Value property of the BuildingBlock object. |
Description | Optional | Variant | Specifies the description of the buildling block entry. Corresponds to the Description property of the BuildingBlock object. |
InsertOptions | Optional | WdDocPartInsertOptions | Specifies whether the building block entry is inserted as a page, a paragraph, or inline. If omitted, the default value is wdInsertContent. Corresponds to the InsertOptions property for the BuildingBlock object. |
Return value
BuildingBlock
Example
The following example creates a new building block entry and adds it to the template attached to the active document, and than sets the value of the building block to the selected text.
Dim objTemplate As Template
Dim objBB As BuildingBlock
Set objTemplate = ActiveDocument.AttachedTemplate
Set objBB = objTemplate.BuildingBlockEntries.Add("Author Name", _
wdTypeCustomTextBox, "Custom", Selection.Range)
See also
BuildingBlockEntries Collection
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.