logo MakeOfficeWork.com
Search Office Sites
Powered by Microsoft Bing™

Forms

Before you start learning about user forms, it is important to understand that a user form can be distributed as a document (.doc or .docx file) or as a template (.dot or .dotm file). When you distribute a user form as a document file to multiple users, each user fills in a copy of the form and saves it with the same name or a modified name. No macros are required in this case. Such forms are often called online forms. On the other hand, a template can have a macro that runs automatically when the user creates a new document based on it. This opens up possibilities for greatly enriching the form created. The user then saves the document created with a user-defined name. When you use a template, one of the things that you can do is have one or more automatically displayed dialog boxes, in which the user fills in information that is added to the document created with the template.

Consider a scenario in which each user is a salesperson who deals with numerous customers. In this case each user can use a form to create a separate document for each customer. In such a scenario, a template offers great advantages. The user would create a new Word document for each customer using the template and save each file with a unique name. The template can also include code that stores the data for all of the user's customers locally in an Excel spreadsheet or in a database, or all of the data from all of the users can be stored centrally through a network.

Microsoft does provide some help for creating forms. For instructions on creating forms in Word 2010 and newer versions, see the Microsoft help topic Create Forms that Users Complete or Print in Word. For instructions on creating forms in Word 2007, see the Microsoft help topic Create Forms that Users Complete or Print in Word.

For more detailed information about creating forms, see Create and Employ a UserForm by Greg Maxey and How to Create a Userform by Doug Robbins.

For more information about creating dialog boxes containing list boxes that are displayed by a template, see Populate UserForm ListBox by Greg Maxey.

Data entered by a user in one place in a form can be made to appear or can be used in calculations in other places in the form. Similarly, the results of calculations based on such data can be made to appear anywhere in the form. For more information on how to do this, see Repeating Data by Greg Maxey.

User forms are typically protected (locked) so that users can add information or modify the form only in specific places, but cannot modify other parts of the document. User forms must be protected to allow users to modify FORMTEXT, FORMCHECKBOX, and FORMDROPDOWN fields. Macros associated with these and other form fields are activated only when the user form is protected.

In any document, you can create a button containing a MACROBUTTON field that will run a macro when a user double-clicks the button. Such buttons can be especially useful in protected areas of a protected user form. Before protecting your form, you can add MACROBUTTON fields, which will enable users to trigger macros that perform tasks that are blocked by the document protection.

To create a button in a document to run a macro

  1. Move the cursor to the place in the document where you want to the button to appear.
  2. Insert a MACROBUTTON field with the name of the macro and a message that instructs users to double-click the button.
  3. Select the field and format it by adding a frame (borders) around it and a background color (shading).

You can press Alt+F9 to view and modify the field code. You should see something like { MACROBUTTON MacroNameGoesHere Double-click }. After you finish, press Alt+F9 again to hide the field code. If you have many fields in your document and do not want to display all of the field codes, you can select a field and press Shift+F9 to display and hide the code of the selected field.

In a particular case, a MACROBUTTON field can trigger a macro that enables a user to follow a hyperlink in a protected area of a user form. For more information about enabling users to follow hyperlinks in protected forms, see Using Hyperlinks in Protected Forms by Cindy Meister and Dave Rado.

Quick Reference for this Page

This page describes the basic types of user forms and provides a guided tour of selected information and tutorials that others have written to help users create forms.

Search Office Sites

You can search the websites that have the most useful and valuable information about using Microsoft Office products by using the Search Office Sites search box in the banner. Click to start your search.

Other Resources