This documentation is archived and is not being maintained.

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

Office 2007

A document building block is a predesigned piece of content, such as a cover page or a header or footer. A document building block enables the user to choose from a defined list of document building blocks to insert into a document. Microsoft Office Word 2007 includes a library of document building blocks that help you to more quickly and easily create professional-looking documents.

You can use content controls to create custom building blocks. The Word 2007 object model contains 35 building block types that you can set to a content control. A new enumeration called WdBuildingBlockTypes contains each building block type. However, you can only use the following 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:


The following code sample sets a building block to a content control.

Sub SetBuildingBlock()

    Dim strTitle As String
    strTitle = "MyTitle"
    Dim objContentControl As ContentControl
    Set objContentControl = ActiveDocument.ContentControls _
    objContentControl.Title = strTitle
    objContentControl.BuildingBlockType = wdTypeAutoText
End Sub