BuildingBlocks.Add method (Word)
Creates a new building block and returns a BuildingBlock object.
Syntax
expression.Add (Name, Range, Description, InsertOptions)
expression An expression that returns a BuildingBlocks 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. |
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 adds a new building block auto text entry to the first template in the collection of templates.
Dim objTemplate As Template
Set objTemplate = Templates(1)
objTemplate.BuildingBlockTypes(wdTypeAutoText) _
.Categories("General").BuildingBlocks _
.Add Name:="New Building Block", _
Range:=Selection.Range
See also
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.