Set the Building Blocks That You Can Use for a Content Control

A document building block is a predesigned piece of content, such as a cover page or a header or footer. Word includes a library of document building blocks that users can choose from to insert into a document.

A ContentControl object (Word) object with a ContentControl.Type property (Word) property value of wdContentControlBuildingBlockGallery specifies a content control that can contain document building blocks.

The WdBuildingBlockTypes enumeration contains each building block type. You can only use the following building block types within a building block gallery content control:

  • AutoText

  • Tables

  • Equations

  • Quick Parts

  • Custom 1 though Custom 5

  • Custom AutoText

  • Custom Tables

  • Custom Equations

  • Custom Quick Parts

For more information about content controls, see Working with Content Controls. The objects used in this sample are:

Sample

The following code sample instantiates a building block gallery content control and then adds a building block to the content control.

Sub SetBuildingBlock()
 
    Dim strTitle As String
    strTitle = "My Equation"
    Dim objContentControl As ContentControl
     
    Set objContentControl = ActiveDocument.ContentControls _
        .Add(wdContentControlBuildingBlockGallery)
    objContentControl.Title = strTitle
    objContentControl.BuildingBlockType = wdTypeEquations
   
End Sub

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.