The Anchorage
Personal website of Gregory K. Maxey, Commander USN (Retired)
The information, illustrations and code contained in my "Microsoft Word Tips" are provided free and without risk or obligation.
However, the work is mine. If you use it for commercial purposes or benefit from my efforts through income earned or time saved then a donation, however small, will help to ensure the continued availability of this resource.
If you would like to donate, please use the appropriate donate button to access PayPal. Thank you!
In this Microsoft Word Tips & Microsoft Word Help page I will discuss building blocks components introduced in Word 2007 and provide a few tools for enhancing their use. Additional, I will address some enhancements/changes to building blocks in Word 2010 and 2013.
Employing a collection of document parts to create professional looking documents is even easier with Word 2007 - 2013. I use the term "document parts" to describe the collection of document properties, fields, and AutoText that existed in previous Word versions along with the new collection of building block galleries and their associated building blocks.
The focus of this article is on managing building blocks and their relationship to the AutoText feature found in previous editions of Word. For more on employing AutoText in general see Charles Kenyon's: AutoText and AutoCorrect in Microsoft Word and my AutoTextList tips page.
Note: Charles has put together a comprehensive treatment of AutoText in his linked article including links to other web resources on the subject; including some of my own. Don't be annoyed if you find your self in a loop. We are both simply trying to provide plenty of information and help for you to peruse.
Building blocks are very similar to AutoText. In the first article link above AutoText is defined as:
"AutoText is a way to store parts of a Word document for re-use. You can, for example, create a library of boilerplate paragraphs for business letters, or keep a handy selection of headers and footers. An AutoText entry can store anything a Word document can contain, such as formatted text, pictures, and fields. Word comes with a number of predefined AutoText entries, and you can add as many as you like."
The definition of AutoText provided above works equally well for building blocks. The key difference is that there is a much larger and richer collection of pre-defined building blocks installed with Word right out of the box!!
This collection is comprised of 35 building block types (or galleries). Each gallery can be subdivided into custom categories containing multiple building block entries. Of the 35 building block types, 15 are built-in and 20 are custom types. Despite that distinction, you are able to customize and define your own custom building block entries in any one or all of the 35 galleries.
Most of the built-in building block galleries are accessed and employed using a gallery control or a combination of menu/gallery controls on the Ribbon user interface. Table 1 below defines the 15 built-in building block types and shows how the associated galleries are accessed.
These dispersed galleries display a collection of defined building blocks as either a partial or full page preview. You simply select and insert the building block at the insertion point from the gallery or right-click the building block in the gallery and select a location to insert the building block. The type of preview that is displayed for each gallery is also shown.
Built-In Building Blocks | ||
---|---|---|
Name | Ribbon Interface | Preview |
Quick Parts | Insert>Quick Parts | Partial |
Cover Pages | Inset>Pages>Cover Pages | Full |
Equations | Insert>Symbols>Equations | Partial |
Headers | Insert Header & Footer>Header | Partial |
Footers | Insert>Header & Footer>Footer | Partial |
Page Numbers (TOP) | Insert>Header & Footer>Page Number>Top of Page | Partial |
Page Numbers (BOP) | Insert>Header & Footer>Page Number>Bottom of Page | Partial |
Page Number Margins | Insert>Header & Footer>Page Number>Page Margins | Partial |
Page Numbers | Insert>Header & Footer>Page Number>Current Position | Partial |
Tables | Insert>Tables>Quick Tables | Partial |
Watermarks | Page Layout>Page Background>Watermark | Full |
AutoText | Insert>Quick Parts>AutoText (Word 2010 only) (**) | Partial |
Text Boxes | Insert>Text>Text Box | Full |
Table of Contents | References>Table of Contents>Table of Contents | Partial |
Bibliography | References>Citations & Bibliography>Bibliography | Partial |
Table 1
Notes:
1. Contrary to some belief, AutoText did not die with the introduction of Word 2007. As shown in Table 1, AutoText has simply been incorporated as one of the building block types. Microsoft developers, however, failed to include an AutoText gallery in the Word 2007 Ribbon interface. I will address this oversight later.
2. An AutoText gallery control was added to the Insert>Text>Quick Parts menu in Word 2010.
Other methods for accessing and employing building blocks include the Building Blocks Organizer, the AutoText gallery control, the 20 custom building block type gallery controls, Building Block Content Controls, keyboard shortcuts F3 and ALT+F3, and—not to be left out—AutoText and AutoTextList fields.
The Building Blocks Organizer (shown below) is opened using Insert>Quick Parts>Building Blocks Organizer. The organizer provides a comprehensive list of all of the building blocks contained in each template in the current template collection.
With the organizer you can see the building block name, gallery (or type), category, template storage location, behavior, and description. You can use the organizer to modify, insert, or delete individual building block entries.
Some shortcomings of the organizer are that the full page preview makes it difficult to distinguish the content of some building blocks, there is an inability to select and delete multiple building blocks, and most disappointing, there is a complete absence of a building block copy feature. I will address these shortcomings as this article progresses.
Note: This tips page was originally developed using Word 2007. You may notice minor differences between your actual installation and the illustrations used here.
Notes:
1. The predefined built-in building blocks entries that ship with Word are stored in a template named Building Blocks.dotx (Word 2007) or Built-in Building Blocks.dotx (Word 2010-2013). The template is located in an application installation folder created when you install Word. For example, my Word 2007 template is located at C:\Program Files (x86) \Microsoft Office\Office12\Document Parts\1033 (where 1033 is a localID number representing the local language {1003 representing U.S. English}). This is the original distribution template and should not be modified.
2. During installation of the application, a parallel folder containing the working Building Blocks templates is created in the user application folder ending with: ...\Microsoft Office\Document Building Blocks. For example, my Word 2007 working Building Blocks templates are located at C:\User\Maxey\AppData\Roaming\Microsoft Office\Document Building Blocks\1033.
My Word 2010 working Building Block Templates are located at: C:\User\Maxey\AppData\Roaming\Microsoft Office\Document Building Blocks\1033\14. The exact location of your working Building Blocks templates will be determined by your
operating system, user name, and installation path.
3. An easy way to get in the ballpark though, is to open Windows Explorer (the My Computer icon on the desktop). In the Address box near the top, paste or type in:
%appdata%\microsoft and press enter.
That will go to the right application folder in any version of Windows, no matter what your user name is, and no matter whether you've selected the option to show hidden folders.
4. In Word 2007, the working Building Blocks template is the default "Save in" template whenever you attempt to create a new building block. In Word 2010/2013, the Normal.dotm template is the default "Save in" template when you invoke the "Create New Building Block" dialog by pressing Alt+F3. However, if you invoke the dialog by selecting one of the "Save Selection to XXXX Gallery" (where XXXX is a named gallery) controls, the default template is the Building Blocks.dotm.
5. The working building block templates are not loaded until you attempt to access your building blocks by clicking on a gallery control or the organizer. This accounts for the initial short delay displaying building blocks on first use in a Word session.
6. Sometimes the working template can become corrupted. When this happens, you can rename (or delete) the working template and then close and restart Word. When Word restarts, a new working template is created from the original distribution template. If you rename the working template (e.g., buildingblocksold.dotx) then you may use the tools described in this page to possibly recover any custom building blocks you have created and stored in it.
7. If you do an in-place upgrade from Word 2003 to Word 2007/2010/2013, the installer for Word 2007/2010/2013 renames your Normal.dot template to something like Normal11.dot. If
you store that renamed template or any template containing an AutoText or Building Block collection into the parallel folder described above, the AutoText/Building Block entries stored in that template will be loaded at the same time as the Building Blocks template entries are loaded. This can be handy when you need short-term access to a large collection of AutoText/Building Blocks. When they are no longer needed, you can relocate the template to another folder.
8. With dual Word installations, I have found that Word 2010 has trouble detecting additional templates placed with the working built-in templates in the ...\1033\14 folder. Placing the additional templates directly in the ...\Document Building Blocks folder works well.
9. Microsoft has finally provided a bit of clarification on these issues as well as a few other tips for employing AutoText here: Add AutoText in Word
The AutoText gallery control, like the other 14 built-in building block gallery controls, provides a preview and access to all of the building block entries defined as type "AutoText."
As mentioned above, the developers at Microsoft did not include this control on the Word 2007 ribbon. You can add it to your Quick Access Toolbar (QAT) by right-clicking the QAT and selecting "Customize Quick Access Toolbar." When the customization dialog appears, select "All Commands," then in the "Choose commands from" dropdown, scroll down and select "AutoText," then click on "Add." Customize Quick Access Toolbar "For all documents (default)" or in the appropriate template.
The AutoText gallery can also be added to the ribbon using ribbon customization methods, but more on that later.
Note: Microsoft has simplified user access to the built-in AutoText gallery in Word 2010 by adding the control to the Insert>Quick Parts menu.
The 20 custom building block types are shown in Table-2 below. As you can see in the table, there is a custom gallery corresponding to each built-in gallery plus five additional custom galleries. Like the AutoText gallery, all of the 20 custom galleries can be added to the QAT or ribbon.
Custom Building Block Galleries |
---|
Custom Quick Parts |
Custom Cover Pages |
Custom Equations |
Custom Headers |
Custom Footers |
Custom Page Number (Top of Page) |
Custom Page Number (Bottom of Page) |
Custom Page Number (Page Margin) |
Custom Page Number (Current Position) |
Custom Tables |
Custom Watermarks |
Custom AutoText |
Custom Text Boxes |
Custom Table of Contents |
Custom Bibliography |
Custom Gallery 1 |
Custom Gallery 2 |
Custom Gallery 3 |
Custom Gallery 4 |
Custom Gallery 5 |
Table 2
The 35 building block types or galleries simply provide enhanced organization and grouping of the built-in and your custom-defined building blocks. The galleries are yours to do with what you wish. You could create a new building block and store it in any one of the 35 galleries. For example, you could create a group of building blocks consisting of some of your favorite images in a "Favorite Pictures" category of the custom Text Box gallery. By doing this you would take advantage of the Text Box gallery full page preview. I realize that your favorite pictures aren't really textboxes; but hey it is your program, so use it how you like.
Like AutoText in previous Word versions, building blocks are defined and created based on a selection in the document. As the definition provided above states, this can be anything a Word document can contain, such as formatted text, pictures, and fields.
ALT+F3 is still the keyboard shortcut used to create a new building block. When you select an item (block of text, image, etc.) and press ALT+F3, a Create New Building Block dialog is presented, as shown below.
The values initially displayed in the dialogs are always the same, but are defined by the version of Word you are using.
With either dialog, you can use the default values or change the values to create the new building block in any one of the 35 galleries, assign a custom name, choose from an existing category or create a new category, or define a different template storage location.
An alternative method for creating a new building block is using the "Save Selection to XXXX Gallery" command that appears at the bottom of each of the built-in gallery menu controls (where XXXX is the gallery name).
Using these controls display the Create New Building Block dialog similar to using ALT+F3. The difference being that the Type initially displayed will match the Type of the gallery control used and the Save-in location in most all cases (except the AutoText gallery control in Word 2010/2103) will be Building Blocks.dotx. Again, since you can change the values in the dialog, you can use any one of these controls to create and define a building block in any of the 35 galleries.
You can also create a new building block programmatically using VBA by defining the storage template, name, type, category, range and insert option using code similar to that shown below.
Sub AddBBProgramatically() Dim oRng As Word.Range Dim oTmp As Template Set oRng = Selection.Range sPath = Options.DefaultFilePath(wdUserTemplatesPath) & "\Normal.dotm" Set oTmp = Templates(sPath) oTmp.BuildingBlockEntries.Add _ Name:="New BB", Type:=wdTypeQuickParts, Category:="New Category", _ Range:=oRng, InsertOptions:=wdInsertContent lbl_Exit: Exit Sub End Sub
Notes:
1. The procedure above stores the building block created in the Normal.dotm template. You can change the path and template as appropriate to your needs.
2. The parameter "Type" assigns the gallery type similar to "Gallery" field in the "Create New Building Block" dialog.
3. See: Installing Macros for instructions on how to set up and use the macros provided in this Microsoft Word Help & Microsoft Word Tips page.
4. See: Build & Employ Custom Building Block Gallery for a fully automated building block generating tool.
If the building block entries you create in one session of Word are not available when you close and restart Word, then the possibility exists that your target template is not being saved properly.
This could be due to damage/corruption of the file itself or incorrect permissions on the template folder (for the Normal.dotm template this folder is normally %appdata%\Microsoft\Templates). After you create an entry and close Word, go to the template's storage folder and check the templates "Modified date/time" to see if it updated.
In addition to the methods previously discussed, there are several other methods you can use to enter a building block in your document:
You can select and insert a building block using the organizer.
You can insert a building block after typing part of the building block name and then pressing F3.
Note: You have to type just enough characters to distinguish the building block from all other building blocks, otherwise Word displays an alert in the status bar, "The specified text is not a unique building block name. Provide a unique name."
To the great dismay of many, the handy "Show AutoComplete suggestions" feature available with AutoText in previous Word versions is not available in Word 2007.
Fortunately, this feature was restored, to a point, with Word 2010 and even further in Word 2013. To activate this feature use File>Options>Advanced>Editing Options>Show AutoComplete Suggestions.
While unwilling to forgive Microsoft for the omission of Show AutoComplete Suggestions in Word 2007, moving from a single AutoText object to thirty-five building-block galleries with an unlimited number of categories understandably "muddied the water" so to speak. I can imagine the challenge and appreciate the technical effort that it took to get it restored to the point that it is.
To have success with the Show AutoComplete Suggestions feature in Word 2010, one of the following two conditions must be met:
Show AutoComplete Suggestions will not be displayed if your building block entries are defined and saved in building block.dotx or any other template location.
Unlike the F3 key auto entry method where a single unique first character is sufficient to make the auto entry, you must type at least the first four characters of the building block name and enough characters to be unique before Show AutoComplete Suggestions is displayed.
In Word 2013 building block entries stored in other templates which are loaded as add-ins will also trigger the AutoComplete suggestion prompt. Building Blocks stored in the dedicated Build Blocks.dotx file still do not trigger AutoComplete Suggestions.
Note: As mentioned previously, the ability to define building blocks in multiple galleries, categories, and templates has dramatically complicated Word's "under the hood" process of determining which building block entry to insert when you attempt to use either the F3 key or ShowAutoComplete Suggestions method. The difficulty is exacerbated if you have defined two or more liked-named building blocks in two or more different galleries or templates and the behavior you see when you try to use either F3 or Show AutoComplete Suggestions can be perplexing.
1. If you define building blocks using the same name in two different galleries, the F3 auto insert method will not recognize or insert a building block unless one of the galleries used is the Quick Part (AutoText if using Word 2010/2013) gallery. In that case the F3 key (and Show AutoComplete suggestions in Word 2010/2013) will recognize and enter the building block as defined in the Quick
Part
(AutoText if using Word 2010/2013) gallery.
2. Similarly, using like-named building blocks in two or more templates (e.g., the active document template, the normal template, or the building blocks template) may be confusing. The general hierarchy is document template, normal template, and built-in template.
You can insert a building block type content control. Using the Developer Tab>Controls group, select "Building Block Gallery." This automatically inserts a content control that contains all of the building blocks in the Quick Part gallery. Once inserted, you can use the Content Control properties dialog to define the gallery and category displayed.
Sub EnterBBProgramatically() Dim oRng As Word.Range Dim oTmp As Template Dim sPath as String Set oRng = Selection.Range sPath = Options.DefaultFilePath(wdUserTemplatesPath) & "\Normal.dotm" Set oTmp = Templates(sPath) oTmp.BuildingBlockTypes(wdTypeQuickParts).Categories("General") _ .BuildingBlocks("MyBuildingBlock").Insert Selection.Range lbl_Exit: Exit Sub End Sub
Notes:
The code assumes, of course, that you have a "General" category defined in the Quick Part gallery of your Normal.dotm template containing a building block named "MyBuildingBlock.
The insert option defined when a building block is created is ignored when a building block is inserted using the auto complete suggestion, F3 or with simple code as shown below. The only insertion methods that produces the "in its own paragraph, or in is own page" is to insert via the gallery controls or using an advanced code method.
You can delete a building block entering from any template in the current template collection using the organizer. The organizer is accessed from the Insert>Quick Parts ribbon control or from right-clicking a building block preview in a gallery and selecting "Organize and delete."
Building blocks can be deleted individually or in mass using VBA. The following provides the simple code to delete an individual building block.
Sub DeleteBBProgramatically() Dim oTmp As Template, sPath as String sPath = Options.DefaultFilePath(wdUserTemplatesPath) & "\Normal.dotm" Set oTmp = Templates(sPath) oTmp.BuildingBlockTypes(wdTypeQuickParts).Categories("New Category"). _ BuildingBlocks("New BB").Delete lbl_Exit: Exit Sub End Sub
Now that you are familiar with what building blocks are and how to create and employ them I am going to shift focus and address some of the shortcomings in the built-in ribbon interface and building block organizer.
My solution to these shortcomings is in the form of a Word template add-in that you install and load manually or automatically from the Word startup directory. This add-in provides RibbonX customization of the ribbon that modifies existing controls and adds several additional controls to the ribbon. This gives you more control over creating, accessing, and organizing your building blocks collection.
When the add-in is loaded for the first time you will need to accept the disclaimer.
After accepting the disclaimer and dismissing the Usage Tips\Credits dialog, the following default configuration dialog is displayed. Using this dialog you can customize the add-in to better suit your particular needs. You can:
Click "Save Settings" to dismiss the configuration dialog and display the add-in user interface.
With the add-in default configuration, the following user interface is defined:
The custom Building Blocks tab consists of four groups shown below.
Note: On smaller screen displays, one or more of the groups may be truncated.
Use the controls in the Configuration/Tools group to:
The Organizer Enhanced Tools button control displays a Userform interface providing functions to export\import (copy), modify, insert or delete (individual or multiple) building blocks from the selected template.
Note: After many failed attempts, I think that I have finally managed to faithfully copy building blocks that involve a page layout (e.g., cover pages). Please provide feedback if you discover that this is not the case.
The Building Block Loader menu control provides the interface for creating and managing building blocks using an external "Definition Table." A description of this function is provided below:
Edit Definition Table - The add-in contains a building block definition table used for defining and creating groups of building blocks. When you click this button, the template add-in opens as a document.
With the add-in file open, you can modify add or modify building block definition rows as required.
Load/Refresh Building Blocks:
Each of the 35 Building Block gallery controls defines a primary menu shown below:
The Preview\Insert control is a built-in control. It provides a preview and means to insert any building block in the selected gallery contained in any loaded template.
The Create Building Block control opens a custom dialog to create a new building block as defined by the selected text in the selected gallery.
An individual dynamic menu control for each template in the current template collection that contains one or more building blocks.
The Refresh Menu command is used to refresh the selected gallery. Galleries should be refreshed individually or globally any time you load or unload a template from the current template collection or create, deleted or redefine a building block using methods external to the add-in.
Template dynamic menus. Each template dynamic menu provides a means to create new building blocks directly in the selected template\gallery, delete building blocks in the selected template gallery and insert by selection is a list of any building block in the selected template\gallery.
Note: The display of the primary and dynamic menus will depend on the building block content of the selected gallery control. For example, if a there are no building blocks defined in a particular gallery the following is displayed.
I have made a few subtle, top-level changes to the Insert tab>Text group. I renamed the group "Document Parts & Text" and reordered and changed "Quick Parts" to "Document Parts." In my opinion, "Quick Parts" is a poor label as the collection of Document Properties, Fields, and Building Blocks are more properly classified as "Document Parts."
As illustrated below, the new Document Parts control consists of:
Notes:
1. There are some unavoidable redundancies in the modified user interface as the Quick Part Gallery control is unique in that, in addition to displaying the preview of Quick Parts building blocks and "Save Selection to Quick Part Gallery" control, it displays a collection of other tools (e.g., Document Property, Field, etc.).
2. I wanted to move the Quick Parts preview off the Document Parts menu since the preview can push these additional commands to the bottom of the screen and then re-create the other tools directly on the new Document Parts menu.
3. Since "QuickPartsInsertGallery" is a built-in control its content cannot be edited, this results in the other tools being displayed both on the Document Parts menu (as intended) and on the "QuickPartsInsertGallery" control (the redundancy).
The Custom Galleries control displays a menu of the 20 custom galleries.
The Organizer Enhanced Tools and Building Block Loader controls function as described above.
The Document Variables control displays a custom dialog for managing and working with document variables. Using this dialog, you can see a list of any variables assigned in the document and review its value. The dialog can also be used to create, insert, or delete document variables.
Use the Building Block Ribbon Tab toggle button to show/hide the add-in ribbon tab.
Similar changes are made to the Header & Footer Tools contextual tab.
Finally, the last feature in the add-in is the "Building Block QuickPick" contextual right click menu control.
Disabled by default, if you open the configuration dialog you can customize the text contextual right click menu.
With this dialog you can quickly drill down and select the correct Building Block to insert in a document.
This concludes this Microsoft Word Help & Microsoft Word Tips page. I hope that it gives you a better understanding of building blocks and that you enjoy using the tools to enhance their use. You can download the template add-in here: Building Blocks Add-In.
For more on template add-ins and how to load them, see Organizing Your Macros/Template Add-ins at: Installing Macros
The information, illustrations and code contained in my "Microsoft Word Tips" are provided free and without risk or obligation.
However, the work is mine. If you use it for commercial purposes or benefit from my efforts through income earned or time saved then a donation, however small, will help to ensure the continued availability of this resource.
If you would like to donate, please use the appropriate donate button to access PayPal. Thank you!