Lisa Wollin, Microsoft Corporation
Applies to: 2007 Microsoft Office System, Microsoft Office Word 2007
A building block gallery is a collection of building block entries that are of the same type. There are 35 different types of building block collections that you can create. Microsoft Office Word 2007 uses some of these for built-in building block galleries, but most of them are available so that you can organize your own custom building block galleries.
Building blocks are stored within Word 2007 templates. To access the building block galleries for a document, you need to first access the template that is attached to the document. Use the Add method of the BuildingBlockEntries collection to add a building block entry to a gallery. When you add entries to a gallery, Word creates both the gallery and the category, if they do not already exist.
The following example shows how to add building block entries to a gallery. This example assumes that there are three paragraphs in the active document.
Sub CreateBuildingBlockGallery()
Dim objTemplate As Template
Dim conType As WdBuildingBlockTypes
Dim objRange As Range
Set objTemplate = ActiveDocument.AttachedTemplate
conType = wdTypeCustom1
Set objRange = ActiveDocument.Paragraphs(1).Range
objTemplate.BuildingBlockEntries.Add _
Name:="Primary Heading", _
Type:=conType, _
Category:="Headings", _
Range:=objRange
Set objRange = ActiveDocument.Paragraphs(2).Range
objTemplate.BuildingBlockEntries.Add _
Name:="Secondary Heading", _
Type:=conType, _
Category:="Headings", _
Range:=objRange
Set objRange = ActiveDocument.Paragraphs(3).Range
objTemplate.BuildingBlockEntries.Add _
Name:="Tertiary Heading", _
Type:=conType, _
Category:="Headings", _
Range:=objRange
End Sub
Building block entries are very similar to auto text entries, but you can organize building blocks much more effectively than auto text entries. Each building block entry is comprised of a type and a category. Word provides the ability to create multiple categories within a gallery to allow you to further organize your custom building block entries.
|
Watch the Video
Video Length: 00:4:42
File Size: 3.5 MB WMV
|