Making Forms with Microsoft Word

by Charles Kyle Kenyon, Esq.

There are no expectations that this chapter will ever be of the same quality and depth as the other chapters of this guide. That is because it was written by a single author not working with Microsoft. I am not an expert at this, I'm a lawyer with a passion for efficiency and effectiveness. You will not find this chapter on the Microsoft site. Comments are welcome.

You should have reviewed Basic Formatting, Tables and the bookmarks and cross-reference portions of Complex Legal Documents before tackling this chapter.

Click here to break out of a frame.

What You Will Learn

After completing this lesson, you will be able to:
bulletSet up a form so that when information is added, everything else does not move.
bulletKnow the difference between using modern Content Controls and Legacy Form Controls.
bulletKnow why you generally do not want to use ActiveX Controls.
bulletKnow what the controls on the Forms Toolbar (or Developer Tab Legacy Forms dropdown) are for.
bulletCreate an online form to mimic a paper form.
bulletCreate an online form to fill in a paper form and learn why you probably don't want to attempt this.
bulletCreate an online form to replace a paper form.
bulletCreate an online form to prepare a draft legal document.
bulletGive the online form user help and on-screen hints.
bulletUse form fields that restrict data entry.
bulletProtect a forms document from modification.
bulletProtect only part of a forms document from modification.
bulletUnlock and re-lock a forms document without resetting forms fields.
bulletSpell Check a Protected Form.
bulletAdd "Radio" buttons to a Form.
bulletPut buttons on your form for your user that don't print out.
bulletUse MacroButton fields in protected portions of your forms (to mimic hyperlinks, among other things)

Additional Written (and Web) Resources

bulletWord 97 for Law Firms by Payne Consulting Group. (also at Amazon.com UK)
bulletWord 2000 for Law Firms by Payne Consulting Group. (also at Amazon.com UK)
bulletWord X (2002) for Law Firms by Payne Consulting Group. (also at Amazon.com UK
bulletPlease Fill Out This Form - series of articles by Dian D. Chapman, MVP (Dian was formerly known as Dian D. Chesney) - This series is one of the best places to start learning about forms - and a place to return for a refresher when something has you stumped! (Note, this site has been down for more than a year. These links are to archival versions.)
bullet Please Fill Out This Form 1 - Creating a Form
bullet Please Fill Out This Form 2  - Automating the Form
bullet Please Fill Out This Form 3  - how to create a form that uses message boxes to inform users and input boxes to request specific information
bullet Please Fill Out This Form 4 - Custom dialog boxes (userforms) to assist with filling in / using a form - beyond the message and input boxes
bullet Please Fill Out This Form 5 - Linking to a DataBase
bullet Creating Forms Using Content Controls by Greg Maxey, MVP
bullet Creating Forms in Word 2003 by Paul Edstein, MVP (macropod)
bullet Creating Forms in Word Using Content Controls by Kevin Stratvert (video)
bullet Adding Content Controls to a Template - Microsoft
bullet Creating Automated Forms Using VBA by Greg B. Chapman, MVP
bullet Lock Up Your Word Document - Office Watch on Restricting Editing (Word 2003 and later but especially Ribbon versions of Word)
bullet Using Word 2010 Checkbox Controls to be mutually exclusive (radio button action)
bulletHow to best create fill-in-the-blank lines on a form, Suzanne S. Barnhill, MVP and David Rado, MVP
bulletForms FAQ by Cindy Meister, MVP
bullet How to Extract Data from Forms and Content Controls by Graham Mayor, MVP - also can be used to convert legacy forms to content controls!
bulletHow to enable the spell-checker in a protected document, Dave Rado
bulletHow to hide a "Print" command button on a Form so that it doesn't print by Ibby
bullet Mapped Content Controls and Document Properties - Repeating data within a Word Document using these features by Charles Kenyon
bullet Repeating Data - entering once and having it show up elsewhere! by Greg Maxey, MVP
bulletBookmarks and Fields Sampler by Joseph Freedman with additions from Charles Kenyon
bullet How to change the action of the Enter key in forms (also Q187985)
bulletHow to validate the contents of a Word Form field by Dave Rado, MVP
bulletHow to set the "tab order" of a Word Form by Dave Rado, MVP and Mark Tangard
bulletThe best way to select a form field using VBA by Mark Tangard
bulletEnable a user to change a "Y" to an "N" and back by double-clicking - by Bill Coan, MVP
bulletWhy Does the Appearance (or layout) of My Document Change When I Open It On a Different Machine? Suzanne S. Barnhill, MVP
bulletHow to insert the filename and path on the last page of a document, such that it will be updated automatically if the filename or path changes by Bill Coan, MVP.
bulletUsing a MacroButton Field to Emulate a Hyperlink in a Protected Form by Charles Kenyon
bullet Creating Forms with Word 2010 (pdf)
bullet Create Forms that Users Complete or Print in Word - Microsoft web site (Word 2007/2010)
bullet Conditional Drop-Down Form Fields
bulletWord Bookmarks by Cindy Meister
bulletHow to find the name of the current formfield by Astrid Zeelenberg
bulletMicrosoft Support - Forms 
bulletTab Key behavior in Protected Forms by Geoff Whitfield - making the tab key go to next form field in the unprotected part of a form
bullet What to do if you forget the password in a locked form by Graham Mayor, MVP.
bullet Quick Parts vs. AutoText - When is one a better choice? by legal office guru Deborah Savadra (video)
- this is a good short video demonstrating use of the Building Blocks Gallery Content Control and other Content Controls in a form letter templaate.
bullet Word 2010 Forms in Depth - online tutorial on lynda.com by Gina Courter
bulletChapter 44 of Microsoft Word 2010 Bible by Herb Tyson, MVP
bulletFrom Word to ... (Getting Data out of Word, esp. Word Forms) by Cindy Meister (Advanced)
bulletMicrosoft Knowledge Base
bulletQ212328 WD2000: How to Create an Online Form Using Form Fields
bulletQ212378 WD2000: How to Control the Tabbing Order in a Form
bullet Q211219: How to change the action of the Enter key in forms (also Q187985)
bulletQ212101 WD2000: Ampersand Is Displayed Incorrectly in Drop-Down List Box
bulletQ212080 WD2000: Length of Form Field Expands or Contracts, Affects Alignment
bulletQ212356 WD2000: How to Update Fields in a Protected Form
bulletQ212540 WD2000: How to Create Mutually Exclusive Check Boxes by Using a Macro (Radio Button Action)
bulletQ95133 WD: How to Create a Checked/Blank Check Box Using FILLIN Fields
bullet Q160988 WD: How to Create Ordinal (Legal) Dates in Form Fields
bullet Q212394 WD2000: AutoCorrect Text Deleted or Partially Visible in Form Field
bulletMicrosoft Support - Forms 
bulletChapter 16 of Microsoft Word 2010 In Depth by Faithe Wempen
bulletCheckboxes Tutorial - Add-In - Examines different kinds of checkboxes, allows putting active checkboxes in a document / template that is not protected for forms.
bullet Create Forms that Users Fill Out or Print on Word for Macintosh - Microsoft - Word 2011 and 2016
Note that this article erroneously labels legacy formfields as Content Controls. There is an important difference.
bullet Cascading Dropdown Controls by Paul Edstein, MVP
bullet Protect Parts of a Word Form by How-to-Geek - good for Content Control forms - better than "filling in forms" protection
bullet Protect Part of a Word Form - video - good for filling in forms protection
bullet How to Make Word Documents Fillable but Not Editable by Word Geek
bullet Creating Forms in Microsoft Word - Video by Scott Hanselman (14 min.)
bullet Add Classic Form Controls to the Ribbon (Word 2007 - 2019) by Greg Maxey, MVP
bullet How to Create a Fillable Form in Microsoft Word | Create a Tab Through Form in Word - video using Content Controls by Chester Tugwell (20 min.)
bullet How To Auto Populate Form Fields in Word - Repeating A User Field in Other Parts Of Your Document - video (legacy form fields) by Sharon Smith
bullet How To Create Fillable Forms In Microsoft Word (Create HR Template Forms) Part 1 (video) by Sharon Smith (legacy form fields)
Make Fillable Forms in MS Word - Content Control Form Fields Part 2 (video) by Sharon Smith (I disagree about using Filling In Forms protection, though)
bulletSample Legacy Forms 
bulletPublic Defender Payment Voucher - Summary cover sheet with five time sheets. Extensive use of tables, cross-references, calculated fields. (download in zip format)
bulletPublic Defender Transcript Request Form (based on printed form - wild layout of fields using tables, some use of bookmarks, use of exit macros to control tab order. (download in zip format)

Macro Package for Form Information Management

bulletDataPrompter by Bill Coan, MVP (used in the White House!)

 

Click to return to table of contents page of Legal Users' Guide to Microsoft Word.Click to go to Microsoft Word new users frequently asked questions site in a new browser window.
(this guide table of contents) ------- (MS Word New Users FAQ)

 

Forms Overview

What I am talking about in this chapter is what is referred to as an online form in Microsoft’s documentation. Such online forms can also be printed forms to be filled out by hand or on a typewriter. These are also often referred to as protected forms because the only place you can type is in the areas open for that on the form. The user can't make changes in the rest of the form, just fill it in.

When used on the computer, these are generally templates that create new documents. These documents are protected from changes in crucial areas. This protection also allows use of special fields inserted with the Forms Toolbar. These fields only work as designed when in a document that has been "protected" for filling in forms. More about the Forms Toolbar later.

An alternative to protected online forms, beginning with Word 2003, would be to use the much more flexible document protection which allows lets exceptions to protection apply by selection rather than simply by Section. This allows spell checking in the unprotected areas but does not provide for use of protected form fields. Instead, you might want to use MacroButton Field prompts and have those unprotected. This concept is not explored further on this page.

Specifically not discussed here are userforms which are a vba construct, ActiveX controls, which also require programming, and the newer content controls. The additional materials referenced at the beginning of the chapter do give information on those.

People should also look into the milder Restrict Editing protection. It may be what you want. Lock Up Your Word Document - Office Watch on Restricting Editing (Word 2003 and later but especially Ribbon versions of Word)

This chapter is about using Word for forms. Microsoft also produces Microsoft Forms which is a completely separate program.

Content Controls and "Legacy" Form Fields

This page is primarily about using "legacy form fields" although there are references to the Content Controls introduced in Word 2007 (and expanded in each version since then). General advice is to not mix legacy form fields and content controls in the same document or template. They do not play well together. However, if you absolutely must do so, read Greg Maxey's white paper (demo) on the subject showing you how to accomplish what you want. Search this page on Content Controls for "Comingling CCs and FFs" to download the whitepaper. The advice on form structure and planning applies to both legacy formfields and Content Controls. Here is a page on using Content Controls for forms: Create a Form Using Word Content Controls by Greg Maxey, MVP

Content Controls are easy to add in the Windows operating system version of Word, not so in the Mac version. Content Controls, though, do work on Macs. You can use documents created with them in the Windows version on a Mac. You can copy Content Controls from such a document on the Mac into another document and they will work in the new document. Neither legacy formfields nor content controls work well in the lesser online or mobile Word programs. John Korchok has created a free Add-In for the Mac that gives ability to add and edit Content Controls in the Mac as well as a page that tells how to do it without his Add-In. Content Controls for macOS by John Korchok

You can create or use "Mapped" Content Controls to make information replicate throughout a document. Updating in one copy of such a control changes the information in all copies. See my page: Repeating Data Using Document Property Content Controls or Other Mapped Content Controls. As with regular Content Controls these are not available to create or edit in the Mac user interface but will work in that interface.

If you are using Content Controls, a key difference between plain-text and rich-text content controls is that with plain-text content controls the tab key will take the user to the next content control while within a rich-text content control, the tab key will insert a tab character within the content control. Unless you need to allow different formatting for part of the information in a text Content Control, plain text (the second icon) is better than the first icon (rich text).

Starting with Word 2013, performance of legacy form fields has degraded. MVP Graham Mayor has provided a utility to convert legacy form fields to content controls. See http://www.gmayor.com/ExtractDataFromForms.htm. I would advise avoiding legacy form fields unless you must use them. Eventually you will want to convert them. The have one advantage in that they have an option to "Update on Exit" which means that anything else in the form that relies on information in the field will be updated when the user tabs out of the field.

Also available, but being deprecated, are ActiveX Controls, which do not work on the Mac or other Word programs. These usually require macros, which are not allowed on many systems. These are a legacy feature predating legacy formfields.

None of the form elements available in Word convert automatically to pdf files. None of them work well in the online or Mobile versions of Word.

Using Tables to organize your page

Tables are the primary method available in Word to organize your page or your information. Here is more general information on Tables.

bullet

Using Tables for Organizing and Formatting in Microsoft Word

bullet

Use Tables and Tabs to Arrange Text in Microsoft Word by Shauna Kelly, MVP

Tables work well for both Content Controls and Legacy Form Fields. You can have your Content Controls or Legacy Form Fields in individual cells or as part of a paragraph of text. You can turn off some or all of the borders in a Table so that the table structure in the page is not obvious. In earlier versions of Word, there was even a button on the Forms toolbar to insert a table.

The Controls

There will be more about the various controls and what they do further down in the page.

Ribbon Versions - on the Developer Tab

The Content Controls are front and center in the Controls Group.

The legacy formfields and legacy ActiveX controls can be accessed in the Windows version using the legacy suitcase dropdown. This menu has one control that is useful even if you are not using legacy formfields, the button to add a Frame.

The ActiveX Controls are not shown or discussed here but are part of the same dropdown from the Developer Tab's suitcase menu.

Older Menu Versions and the Mac

The Legacy FormField Controls are on the Forms Toolbar in pre-Ribbon versions of Word and on the Developer Tab on the Mac. You can view the Forms Toolbar in the Menu versions using View > Toolbars > Forms.

Note the Tables button on that toolbar. This is not on later versions in Windows or the Mac. It really is not needed since there are a number of other ways to insert Tables. This has the control to lock the form.

In recent versions on the Mac, these same controls are found on the Developer Tab. These legacy formfields are sometimes mistakenly referred to as Content Contros, but they are not.

These are the same controls shown for legacy formfields in the Windows version, with the addition of the Lock control.

Starting from Scratch

Word 2007 - 2019 (365) have the controls for Forms on the Developer Tab

You may not even know you have a Developer Tab, but it is there, hidden by default in many releases of Word. Click on the link above to get instructions on how to view it. The forms controls group in Word 2007, 2010 and 2013-2021, respecively look like this:

Forms developer tab Word 2013 help manual

These Content Controls are:

Rich Text Content Control (Use Plain Text instead unless you really need this one)
Plain Text Content Control (icon is a bit lighter)
Picture Picker Content Control
Building Blocks Gallery Content Control - Insert a menu of Building Blocks for the user
CheckBox CC (Word 2010 and later. If you only want user to pick one, use DropDown with choices instead)
ComboBox Content Control (like Drop-Down List but lets user type in own choice)
Drop-Down List Content Control (provide user with fixed choices - one only)
Date Picker Content Control (Provides a calendar to choose from and allows special formats)
Repeating Section Content Control (Word 2013 and later)
Legacy Formfields and Legacy ActiveX dropdown (Not a Content Control - allows access to older form parts)

The controls shown above are "Content Controls" rather than form fields. To access the classic fields and controls, you need to click on the tools valise button. The 2007 version does not have a checkbox content control. The Repeating Section Content Control is available beginning with Word 2013.

Note that the built-in dropdown does not include the lock button and does include ActiveX Controls. Avoid ActiveX Controls unless you are a programmer. The lock button restricts editing for "Filling in Forms" which is the most restrictive form of forms protection and you can get the same effect using the Restrict Editing button on the Developer or Review tab.

For now, this chapter will deal with the classic or "legacy" form fields and what are called protected forms. I recommend using Content Controls instead unless you must use the legacy formfields. If you want to learn more about the ActiveX or content controls review the other references at the beginning of the chapter. Create a Form Using Word Content Controls by Greg Maxey, MVP  Generally you do not want to mix these types of controls.

If you are using the classic/legacy formfields you can get them directly on the Ribbon, including the Lock and Insert Table buttons, instead of using the Tools valise, using a free Add-In from Greg Maxey by clicking on the picture below:

Developer Tab in Microsoft Word - Classic Form Controls

 

Mimicking a Printed Form

You can mimic a printed form by retyping the text and setting its formatting to look like the printed form. You insert your Content Controls or legacy formfields where the information goes. You can constrain the them  so that they won't move other text by putting them in frames or table cells. Otherwise, text that follows a formfield will wrap and flow as in any Word document.

You can format your Content Controls with a non-proportional spaced font like Courier or Courier New to mimic information typed in, or you can put it in the same font as the rest of the form to make the things typed in less noticeable. You can underline the fields to make it look like a printed form, or not.

In Word 97-2003 you will want to work with the Forms Toolbar.

The Forms toolbar can be accessed under the View Menu or by right-clicking in the toolbar area at the top of the page. It has controls for insertion of form fields.

The controls are as follows:

Text form field
Checkbox form field
Dropdown form field
Formfield Options (active when formfield selected)
Draw Table
Insert Table
Insert Frame
Form Field Shading
Reset form fields (blank) - the Eraser - resets all form fields in the form
Protect form (restrict editing to filling in form fields)

 

Locking and Unlocking Forms

When a document is protected for forms, or locked, all you can do is work in the formfields that are in the document and in any unprotected sections. You can lock a document for forms using the padlock button on the Forms toolbar or using the Protect Document command under the Tools menu. This second method gives you the option of setting a password to unprotect the form.

In Word 97-2000 clicking on the lock button of the toolbar will automatically reset your formfields. So, if you type things into your form, unlock it, and then relock it, everything you typed is gone. This can be avoided using a macro to lock the forms.

Sub LockUnlockFormToggle()
' Toggle macro to protect / unprotect form
' Written by Charles Kenyon
Dim Doc As Document
Set Doc = ActiveDocument
If Doc.ProtectionType <> wdNoProtection _
Then Doc.Unprotect _
Else: If Doc.ProtectionType = wdNoProtection _
Then Doc.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
Set Doc = Empty
End Sub

(For information on how to insert this macro into your templates, see Inserting Macros.)

In Word 2002-2003 the lock button on the Forms toolbar will not reset fields but the menu command still will. You can also use the eraser on the toolbar to reset the fields.

In Word 2007-2013, to use legacy formfields you would lock the form using the Restrict Editing button. (This button is on the Review and optional Developer tabs.) The restriction would be for filling in forms. This "locks" the document in the same manner as the lock button in Word 2002-2003.

In the Ribbon versions of Word you can also Restrict Editing to allow no changes with exceptions. I generally set the exceptions to be for everyone. This requires selecting the areas you want to allow changes and marking them as exceptions. This gives more flexibility and allows use of more Word features. It does not necessarily lock the form down as stringently as filling in forms protection. You should not mix Ribbon-version content controls and legacy formfields in the same document.

Starting from a Printed Form

In my practice, often a printed form will come in that it would be helpful to be able to fill in using Microsoft Word.[1] This breaks down into

bulletthose forms that you want to be able to type and print in Word to look as if they were typed on the actual paper form,
bullet

those forms that you want to be able to type in Word and print to the actual paper form,

bullet

those forms  that you want to be able to type and print in Word to look close to the paper form, and

bullet

documents that will be forms that you want to look like they were custom-created for one job.

Let’s take a look at each of these possibilities although not necessarily in that order.

Mimic forms

Getting a Word-printed form to look exactly like the pre-printed form can be very difficult because the fonts and spacing options are different. Probably the simplest way to mimic a paper form is to scan it in a high-resolution scan (at least 600 dpi) and use that as the basis for your document.

When you scan the document, clean it up in your scanning program. That means remove any extra marks or things that shouldn’t be on the form. Straighten the image up so that a horizontal line drawn in Word is going to match a horizontal line on the form. Crop off any extra margin area. Save the scanned image into your template’s folder using a picture format that Word recognizes. I would suggest JPG, PNG, or GIF. For purposes of this tutorial, let’s call your scanned image “form.jpg.”

Open Word.

Format your margins to those of the printed form.

Switch to View Headers and Footers.

You are going to import the form's computer image file into your document’s header. Draw a text box in the header that fills the entire page. (Insert | Text Box). Click inside the textbox.

Insert your scanned image in the textbox. (Insert | Picture | From file) (Select the option to “link” rather than insert or insert and link.)

Right-click on the image and select Format Picture.

Click on the Size tab and make sure your size scale is 100%. Word will likely have inserted at 97% or something close but not at the 100% that you need. Close the Format Picture box by clicking on OK.

Move your pointer to the edge of your text-box and right-click on the text-box border. Select “Format Text Box” from the short-cut menu.

Change the options under Fill to “No Fill” and Line to “No Line.”

Click on the Layout tab and then click on the box that says “Behind text.”

Click on the “Advanced” button and on the Position Tab click in the “Absolute position” radio buttons and select “from page” as the reference for both vertical and horizontal spacing. Uncheck the box that says “Move object with text” and check the box that says “Lock anchor.”

 

Once you have your background, you would use the Forms Toolbar (or Developer Tab in later versions) to insert a borderless table or frames to place your form fields in the blank areas on the background image so the form can be filled in. From here it is like starting from scratch except you don't add the text.

 

Spell-Checking Forms

The regular Spell Checking tool is disabled in protected Forms protected for filling in forms. This is the only protection method available in menu versions of Word. Ribbon versions have methods that do not disable Spell Check. These use Content Controls rather than the "legacy" controls from the menu versions. Create a Form Using Word Content Controls by Greg Maxey, MVP

However, you can use a macro to spell check the contents of your fields and any unprotected sections. You can explore this on the MVP FAQ site. This macro works in versions of Word from Word 97-2003 so far as I know.

Pre-Printed Forms

This is an extreme challenge to do with any word processing program. Word is no exception. You will keep more of your hair if instead you try to either scan the form and use the scanned image as a background for Word fields or reproduce the form from scratch. Otherwise, what you will want to do is either create a (borderless) table that has spaces for your fields that match where your fields are on the paper or insert frames to hold the fields. In either case, if you change the printer (or even the printer driver) you may need to reform your page.

To print on the preprinted form using a scanned image that will not be printed as background, start by positioning the image in the page as a floating picture. Print this on your form and adjust until the printing lines up perfectly with the preprinted form. Then position your fields on the form. If using Content Controls, when you print, make sure that the option to print images or drawings is turned off. If using legacy form controls you can use the option to print data only.

You will be money ahead (assuming your time is worth at least minimum wage) buying a top-of-the-line typewriter and typing these by hand rather than trying to print them using a Word Processor.

Another good alternative is to scan the form and use it as the basis for an Adobe Acrobat form. This is not a Word function but is done relatively easily using Adobe software. (It does require the full Adobe Acrobat program, not just the free reader.)

As of the beginning of 2018, Adobe Acrobat 8.0 Pro is available for free download from Adobe. While this is older software, it will handle this function.

Word Help topics:

Word 2000

·         Create a Form

·         Overview of Forms

Word 97

·         Create an online form

 

WD97: How to Code the ENTER Key to Move to Next Field in Protected Form

The information in this article applies to:
bulletMicrosoft Word 97 for Windows


SUMMARY

This article contains four Visual Basic for Applications macros that you can use to emulate the Microsoft Word 6.0 for Windows functionality of the ENTER key for moving between form fields in protected documents.

In Microsoft Word 6.0 for Windows, if you press the ENTER key in a document protected for forms, the insertion point moves to the next form field. By contrast, in later versions of Word, the ENTER key does not move to the next form field but instead inserts a paragraph mark, just as it would in an unprotected document. This allows you to enter multiple lines of text into a text form field.

 

MORE INFORMATION

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Solution Provider or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Solution Providers, please see the following page on the World Wide Web:

http://mcspreferral.microsoft.com/
For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

http://support.microsoft.com/directory/overview.asp

What follows are the four Visual Basic for Applications macros that you can use together to emulate the Microsoft Word 6.0 for Windows functionality of the ENTER key in new protected form field documents based on a template.

For this code to work as written, the template should not be protected.

The first macro moves the insertion point to the next form field. The second macro assigns the first macro to the ENTER key. The third macro adds an AutoOpen macro to the ENTER key. The fourth macro removes the assigned macro to the ENTER key, restoring the default functionality of the ENTER key.

First Macro: Moves the Insertion Point to the Next Form Field

This macro moves the insertion point to the next form field. If the current form field is the last one in the document, it moves the insertion point to the first form field.

This macro uses the Bookmarks collection to retrieve the name of the current form field. The name of each form field is also the name of a bookmark inserted for the form field. If you have any other bookmarks in your document, you may have to add more code here to handle potential errors. The macro also assumes that all form fields in the documents allow user input. If this is not the case in your document, you will have to add additional code in your macro.

The macro checks whether the current section is protected or unprotected, and then either moves to the next form field (in a protected section) or inserts a paragraph mark (in an unprotected section). This functionality is necessary for documents that contain both sections that are protected for form input and for unprotected sections.
   Sub EnterKeyMacro()
   ' Check whether the document is protected for forms
   ' and whether the protection is active.
      If ActiveDocument.ProtectionType = wdAllowOnlyFormFields And _
      Selection.Sections(1).ProtectedForForms = True Then
         ' Retrieve the bookmark of the current selection.
         ' This is equivalent to the name of the form field.
         myformfield = Selection.Bookmarks(1).Name
         ' Go to the next form field if the current form field
         ' is not the last one in the document.
         If ActiveDocument.FormFields(myformfield).Name <> _
         ActiveDocument.FormFields(ActiveDocument.FormFields.Count) _
         .Name Then
            ActiveDocument.FormFields(myformfield).Next.Select
         Else
            ' If the current form field is the last one,
            ' go to the first form field in the document.
            ActiveDocument.FormFields(1).Select
         End If
      Else
      ' If the document is not protected for forms,
      ' insert a tab stop character.
         Selection.TypeText Chr(13)
      End If
   End Sub 

Second Macro: Assigns the EnterkeyMacro Macro to the ENTER Key

This macro attaches the EnterKeyMacro macro to the ENTER key, thereby reprogramming the function of the key when it is used in protected document form fields. When you use this macro in a custom template, name it "AutoNew" (without the quotation marks). This will change the functionality of the ENTER key in all new form documents based on the template.
   Sub AutoNew()
    ' Do Not protect the template containing these macros.
      CustomizationContext = ActiveDocument.AttachedTemplate
      ' Bind the ENTER key to the EnterKeyMacro.
      KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyReturn), _
      KeyCategory:=wdKeyCategoryMacro, Command:="EnterKeyMacro"
      ' Reprotect the document with Forms protection.
      ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
   End Sub 

Third Macro: Adds an AutoOpen Macro to the ENTER Key

Add an AutoOpen macro with the following code. This ensures that the key functionality will continue when you open a document based on the form template in the future.
   Sub AutoOpen()
   ' This macro will reassign the ENTER key when you open an existing
   ' Word form fields document.
      CustomizationContext = ActiveDocument.AttachedTemplate
      ' Bind the Enter key to the EnterKeyMacro.
      KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyReturn), _
      KeyCategory:=wdKeyCategoryMacro, Command:="EnterKeyMacro"
    End Sub 
NOTE: Running these macros may disable some functions, such as AutoCorrect and AutoText, and may affect other features that depend on the ENTER key for proper operation. You need to run the fourth macro to restore the default functionality of the ENTER key or restart Microsoft Word.

Fourth Macro: Removes the Command Assigned to the ENTER Key

This macro restores the default functionality of the ENTER key. When you use this macro in a custom template, name it AutoClose.
   Sub AutoClose()
      CustomizationContext = ActiveDocument.AttachedTemplate
      FindKey(KeyCode:=BuildKeyCode(wdKeyReturn)).Disable
      ' Disables prompt to save template changes.
      Templates(1).Save
   End Sub 
NOTE: The CustomizationContext property sets the location where the keyboard customization is to be saved, in this case the template attached to the active document.

For additional information, please see the following article in the Microsoft Knowledge Base:
Q173707 OFF97: How to Run Sample Code from Knowledge Base Articles

 


REFERENCES

For more information about getting help with Visual Basic for Applications, please see the following article in the Microsoft Knowledge Base:

Q163435 VBA: Programming Resources for Visual Basic for Applications

Create a Form to Protect Information and Allow User Input

Do you ever want people to enter information in a document and, at the same time, prevent them from changing certain information? An easy solution is to create a form in Microsoft Word 2000. A form allows users to enter information, while it prevents unauthorized persons from changing the form.

Create a form with a table

It's simple to create a form in Word 2000. You can use a table to lay out the form and then enter form fields in the cells where you want information entered or updated. A form field can be a Text Form Field, a Check Box Form Field, or a Drop-down Form Field. Text form fields are used when you want the user to enter information, such as names and addresses. The check box and drop-down form fields allow users to select items that are on the form.

Word form fields

Step 1 - Create a table

  1. On the View menu, point to Toolbars, and then select Forms.
  2. On the Forms toolbar, click Insert Table.
  3. On the table that appears, drag your mouse to select the number of rows and columns you want.
  4. Adjust the columns to the appropriate widths.

Step 2 - Create a form

  1. In the first row of your table, enter a heading (a field label) in each column.
  2. In the row under each column, click the place where you want users to enter information.
  3. On the Forms toolbar, do one of the following:
    To Do this
    Enter a Text Form Field
    Click Text Form Field.
    Enter a Drop-Down Form Field Click Drop-Down Form Field.
    Enter a Check Box Form Field Click Check Box Form Field.
  4. Double-click each blank field that appears in the table.
  5. In the dialog box for each form field, do one of the following:
    For Do this
    A Text Form Field
    1. Under Type, select  the appropriate information type to be entered in the field.
    2. Under Default text, enter text that you want to appear in the field.
    3. Under Maximum length, define the maximum size of the field.
    A Drop-Down Form Field
    1. In the Drop-down item box, type an item you want to appear in the list box, and then click Add.
    2. Repeat step 1 until you have entered all the items.
    3. Use the Move up and down arrows to list the items in the order you choose.
    A Check Box Form Field 
    1. If you want the check box to be a certain size, under Check box size, click Exactly, and then select a size. The default is Auto.
    2. If you want the box to be checked, under Default value, select Checked. The default is Not checked.

Step 3 - Protect the document

Before you distribute the form, you need to protect the document.

  1. On the Tools menu, click Protect Document.
  2. Under Protect document for, click Forms.
    If you created sections in your document, click Sections to specify which sections you want to protect. For example, you might want to create separate sections for a table with data that users cannot modify and a table in which users can enter data.
  3. If you want others to be able to change the form, under Password, enter a password that you share with users who are authorized to change the form.

To quickly protect your form

bulletOn the Forms toolbar, click Protect Form.

For more information about creating forms, type create a form in the Office Assistant or on the Answer Wizard tab in the Word Help window, and then click Search. For information on creating sections, type insert sections in the Office Assistant or on the Answer Wizard tab in the Word Help window, and then click Search.

from http://officeupdate.microsoft.com/2000/articles/wCreateForms.htm


Troubleshooting Forms — Issues To Watch Out For

Q212328 WD2000: How to Create an Online Form Using Form Fields
Q212378 WD2000: How to Control the Tabbing Order in a Form
Q212101 WD2000: Ampersand Is Displayed Incorrectly in Drop-Down List Box
Q212080 WD2000: Length of Form Field Expands or Contracts, Affects Alignment
Q212356 WD2000: How to Update Fields in a Protected Form

IF Fields cannot contain working Form Fields. Word will simply not see the form field as anything other than text when the field is contained inside an IF Field. If trying to display/enable one field based on the results of another, you'll need an on-exit macro in the triggering field which actually inserts the formfield outside of the IF field.

 

Hit Counter page views since 7 September 2001