How to create a template that makes it easy for users to “fill in the blanks”, without doing any programming

Article contributed by Dave Rado

There are basically four approaches you can take:

1.

Create a protected form.

This method is great for creating forms templates, and does let the user tab from one formfield to the next; but it is useless for any other type of template, due to the huge number of restrictions Word's protection feature imposes on the user. For example, see How to enable the spellchecker in a protected document.

On-screen forms are also covered in Word's Help, under the rather misleading title of online forms (misleading because they have nothing whatever to do with web forms).

2.

Use a MacroButton field that doesn't actually run a macro but simply displays a prompt and allows the user to click on the prompt and type. See Microsoft's fax templates (which are supplied with Word) for examples of this. You can simply copy one of the macrobutton fields out of the Microsoft template into your own and amend the prompts as desired. To amend the prompts, select the field and press Shift+F9 to display the field codes. You'll then see something like:

{ MACROBUTTON NoMacro [Click here and type name] }

Change Click here and type name to whatever text you require. Press F9 to update the field, which will also display the display text instead of the field code:

and you're done. (Note that the field shading is an option you can switch on or off under Tools + Options + View).

Alternatively, you can create the field from scratch rather than copying it.

Either:

 

Press Ctrl+F9 to position the field boundaries "{}" (don't type them); then type MACROBUTTON NoMacro and the display prompt. Or

 

Select Insert + Field, and in the dialog, find the MacroButton field. This method is particularly good if you are not used to working with the field in question, because of all the help facilities the dialog gives you (see: Some Tips and Gotchas for those who are new to Word). The former method is quicker, though.

Then press F9 to update the field.

A single left mouse button click anywhere in the field will select the field, allowing it to be overtyped:

Using MacroButton fields is simple, and easy to implement. But the user cannot tab from one field to the next.

3.

Use FILLIN or ASK fields. To do this, select Insert + Field. Then select Fillin or Ask, add the appropriate text and click OK. If you get stuck, look up the topic Examples of ASK and FILLIN fields in Word's Help.

Having inserted the fields, you can simply paste the following code into a little macro called AutoNew, which will update the fields and display the appropriate prompts when a user creates a new document based on your template, and then unlink them so the prompts don't keep reappearing.

If you give a macro the name AutoNew, it will automatically run when a user selects File + New and select the template.

To create the macro, select Tools + Macro + Macros, where it says Macros In select the template; where it says Macro Name, type AutoNew; and click create. Then paste the following code into your macro, save, and you're done:

Sub AutoNew()

Dim Fld As Field

ActiveDocument.Fields.Update

For Each Fld In ActiveDocument.Fields
    If Fld.Type = wdFieldAsk Or Fld.Type = wdFieldFillIn Then
        Fld.Unlink
    End If
Next Fld

End Sub

This is similar to the way WordPerfect users are used to doing it. But the unfortunate souls who have to use this type of template will quickly get fed up with having to fill in a whole series of separate prompts one after another after another after another ... which is why professionally designed templates always use userforms.

4.

Download Bill Coan's DataPrompter [Lene Fredborg, 2-Sep-2022: Replaced outdated link] add-in from www.wordsite.com, and distribute it to your users along with your template(s). This addin allows you to create all the functionality of a professionally designed template, complete with userforms, in a matter of minutes and without any programming at all. It's not free, but it comes with a 30-day money-back guarantee; and as one of its beta testers I can personally vouch that it works brilliantly. In my opinion it is a godsend for anyone who needs to design professional-quality templates but doesn't want (or have the time) to learn VBA.