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.

Insert Content Control Add-in for the PC version of Word

Working on templates for a private client, I soon realised that Microsoft doesn't make it easy to insert, edit and especially map content controls. A while back, in conjunction with Greg Maxey I produced a simplified version of his Content Control tools which can be found at Bookmark and Variables on this site and the more complex version is on his site at Content Control Tools.

Thanks too to Greg for making some valuable suggestions for inclusion and change and especially for the validation process he has provided.

This however was not that helpful in cutting down the number of steps needed to insert a content control, and in fact used the Word dialogs; so I created a simple tool that would insert the Rich Text and Date controls I was working with and that made the job much easier.

The add-in featured here is based on that simple tool and features an additional process to edit combo box and list box content control list items, that I have had hanging around without a home to go to.

The add-in also includes a third function to delete a selected content control, regardless of whether the 'Content control cannot be deleted' or 'Contents cannot be edited' options are set. If the control is not displaying the placeholder text, deletion provides an option to retain the value entered into the control after deletion of the control itself.

When installed in the Word startup folder, the add-in places three buttons on the developer tab and two on the insert tab. 'Developer', as this is the logical place for the controls, but 'Insert' because I was working with bookmarks as well as content controls when I developed the processes and 'Insert' is where the bookmark insertion tool is found.

Insert Content Control

The primary option is that of inserting content controls, and the add-in presents a simple dialog with the main choices displayed. (It does not prevent users accessing the controls later using the built-in content control dialog).

One function that it provides that Microsoft chose to make much more complicated than it needs to be for the type of use that most will need it for, is that of mapping controls. Mapped controls may be repeated by simple cut and paste, and whatever you enter in one of the controls will be echoed in its duplicate. This is a very useful option that most users will not even be aware of, as Microsoft doesn't shout it from the rooftops - as it should, when it provides something that users might actually appreciate (more on mapped controls at the end of this page).

The dialog features a simple dropdown field from which the various types of control are selected. I deliberately avoided the Building Block and Group controls, and for those still using Word 2007, the 'Check Box' control is not an option (as it was introduced in Word 2010) and the 'Include Border' option is not available in Word 2007 and 2010 (as this was introduced in Word 2013).

The options that are available vary according to which type of control is selected.

Date Control

The date control has a pop-out section from where you may select various options. I have chosen only to concentrate on US and UK format dates and those listed in the dropdown are the same as those Microsoft provides.

If you are using the tool to insert a date into a document, rather than a template, there is an option to select a date, which employs a variation of Trevor Eyre's handy VBA date picker.

One very useful opportunity this provides is for inserting fixed dates in documents. Enter a date and check the 'Prevent Deletion' and 'Prevent Editing' options and your document will have a date that is not easily deleted or changed, without accessing the control's properties.

It is not normally recommended that a start datew is included in a template or macro enabled document, so the user is warned when the document is one of those types.

 

Combo and List Box Controls

The combo and list box options also include a pop out panel into which the list items can be entered.

Employing a different 'value' property from the 'display name' property

One of the things you can do with list and combo box entries is provide separate texts for the display name text and value. By default the display name text and value text are the same, and so it was with the earlier versions of the add-in, however prompted by a question made in a Word forum, from version 2.1 of the add-in I have included the ability to have separate texts for display and value.

This works by inserting a pipe character to separate the display name text from the value text. Everything to the left of the first pipe character is the display name text. Everything to the right of that character (and that may include other pipe characters if required) is the value text.

To that end I have included the tip text as shown below.

If you don't need separate values for the two texts, then simply enter the display text alone as described in the earlier part of the page.

Add/Edit/Remove Content Control List Entries

The rest of the control insertions are similar to the Rich Text control, but the example above of the combo box, demonstrates an issue that the second part of this add-in overcomes and that is the editing or the list of values.

The editor now also has the ability to separate the display name and value properties by using a pipe character to separate the two. Thus it is also now possible to add separate value properties to existing controls that don't have them.

Having inserted the control, you may want to sort the list, or you may have spelled a name incorrectly, or you may wish to remove a name from your list. Microsoft doesn't ake this easy - but the second part of the add-in does.

This time there is an entirely different dialog, which will appear if the Word cursor is in a combo or list box content control.

You will notice that the list now includes the placeholder text, and when sorting you would want to preserve that at the top of the list, so the process provides that option

From this dialog you can sort in A-Z or Z-A text order by clicking 'Sort List'.

The Sort button now has the option to undo the sort.

If you click the 'Rearrange List' radio button, Additional options are provided for shuffling the list items around, e.g. you may want to put the ladies names before those of the gentlemen. You can do that from here:

 

Mapped Controls

As I mentioned earlier the add-in provides an option to map add-in controls to the XML code of the document. The most common use of that is to enable content controls to be copied and pasted to provide duplicated entries elsewhere in a document. You can copy and paste e.g. a field containing a date or a name and that name can be reproduced elsewhere in the document by entering a value in any one of the duplicates:

 

And that's all there is to it. I hope you find it useful.

   Click here to download the add-in

 

 

 

Insert Content Controls

Although content controls have been around for some considerable time, and my good friend Greg Maxey has been singing their praises and working with them, I am something of a late convert to their charms.

However that doesn't mean I have unbridled enthusiasm for them, particularly when used in conjunction with the rather poor user interface that Microsoft offers by default.

The add-in featured here aims to improve that.