Graham Mayor

... helping to ease the lives of Microsoft Word users.


Many people access the material from this web site daily. Most just take what they want and run. That's OK, provided they are not selling on the material as their own; however if your productivity gains from the material you have used, a donation from the money you have saved would help to ensure the continued availability of this resource. Click the appropriate button above to access PayPal.

Boilerplate add-in for Word 2007 to 2016

There are several ways that standard texts can be inserted into Word documents. Word, for example includes building blocks which can be used to store formatted items, and autocorrect is surprisingly flexible if you can remember the trigger sequences that would insert your items.

Some time ago a user from the legal profession (where standard texts are in common usage) suggested that it would be handy to have a means of inserting standard texts into documents that could be readily updated should, for example, legislation change requires that wording be altered or replaced.

I set to developing a Word add-in that would do this and the result is described on this page.

The template

The template is stored in the Word startup folder and thus loads with Word. I have included both an installer and the template separately for manual installation.

Some of my other add-ins use the registry to store data used by the add-in, but some corporate users do not make it easy to use the registry in this way, and so all the data used by the add-in is stored in the add-in template itself. This does not however include the boilerplate texts which are saved as documents.

Foremost amongst the items stored in the template is the list of boilerplate texts and their bookmarks. These are stored in a single column Word table. The add-in can employ more than one list of items and these are paged into the template as required.

In practice the modification of the table will be performed transparently to the user.

The add-in has an option to create and number the documents used for boilerplate texts, but if you find it more convenient to do so, you can save the documents without recourse to the add-in. The only provisos are that the filename must be in the format Name_bmnnnn where nnnn is a unique number. (see above illustration).

The numbers do not have to be consecutive, but they must be different from one another. The bookmark name is separated from the name with an underscore character. The underscore character must not be included in the 'Name' part of the filename.

If renaming an existing set of boilerplate files for use with this add-in, you may find the Bulk Rename Utility very useful.

The add-in can work with multiple folders containing sets of boilerplate text documents. Although not essential, it is advisable if boilerplates from different folders are to be used in the same document, that the bookmark numbers are not duplicated in the various folders. To achieve this it would be necessary to rename the files, as the add-in is not aware of the other folders when used to create text items.

The add-in places a group of tools on the Add-Ins tab of the ribbon. This tab is normally present only when add-ins are loaded.

Insert Boilerplate Text

The larger 'Insert Boilerplate Text' button inserts pre-prepared texts into the document.

Select an item to insert and click the 'Insert/Update Selected Text' button to place the text at the cursor position.

Items may be inserted formatted as they are stored in the boilerplate text document or as plain text, by checking or unchecking the insert box beneath the list.

As with all the add-ins from this site a disclaimer text will appear the first time this function is used, and subsequently if the Show disclaimer on startup check box remains checked, or the Reset Defaults button (see below) is clicked.

The three smaller buttons:

  • Save Boilerplate
  • Remove Boilerplate
  • Reset Defaults

are described below:

Save Boilerplate

This function allows a selection from (or the whole of) the current document to be saved as a boilerplate text item to the current set. The only proviso is that the bookmark number is determined by its position in the table. There is a potential for conflicting bookmark numbers to be created if being added to an existing set of numbered items that do not start at number 0001.

The function cannot be used to extract text from a template and will warn the user if that is attempted, and the document containing the texts must be saved before use:

The boilerplate text name does not include the bookmark name. That is provided automatically. You may not enter an underscore character in the dialog. Any attempt to do so will result in the underscore being replaced with a hyphen.

The item is added to the bottom of the table and takes the number of the last row of the table. When next loaded, the table will be sorted alphabetically (as in the case of the last previously added item, which has the bookmark number 0009, but which sorting places at the top of the list).


 

Remove Boilerplate

This function will remove all or selected bookmarked texts from the current document. Beware when using this function if items from more than one list have been added to the document, and those lists have similar bookmark numbers, as there is a potential in such circumstances to remove the wrong texts from the document.

Reset Defaults

The final button removes the table content and the settings that store the user preferences from the template.

 

- Click here to download the add-in

 

 Boilerplate text

Some years ago, I developed an even older Word macro for the insertion of boilerplate texts to enable documents to be combined in a single document - the results of that development can be seen elsewhere in this site.

Development has now turned full circle, and I have developed an application to store a list of boilerplate text items, and insert them in locations in the document that the application bookmarks, thus allowing previously inserted items to be updated.