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 |
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