WD: How to Control the Tabbing Order in a Form

ID: Q120447

The information in this article applies to:

SUMMARY

By default, when you fill in an online form, Word positions the insertion point in the first FORM field and moves from one field to the next in the form when you press the TAB key. (For Word 6.x, pressing ENTER also moves you from one field to the next; this is not true for Word 7.x). To change the default tabbing order, use the procedure described in this article.

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 the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

   http://www.microsoft.com/supportnet/refguide/ 

To change the default tabbing order, assign Exit macros to the FORM fields. These macros use the EditGoTo WordBasic statement to tell Word which FORM field to select next.

Method 1: Single Exit Macro for All FORM Fields

Create a macro similar to sample below and assign it to each FORM field in your document as an Exit macro. In the Select Case statement, list each FORM field for which you want to change the tabbing order along with an EditGoTo statement to tell Word which field to select next.

   Sub MAIN
      Dim dlg As FormFieldOptions
      GetCurValues dlg
      n$ = dlg.Name
      Select Case n$
         Case "To"
            EditGoTo .Destination = "From"
         Case "From"
            EditGoTo .Destination = "Subject"
         Case "Subject"
            EditGoTo .Destination = "Header"
         Case  "Header"
            EditGoTo .Destination = "CC"
         Case "CC"
            EditGoTo .Destination = "Memo"
         Case "Memo"
            EditGoTo .Destination = "To"
         Case Else
      End Select
   End Sub

Method 2: Separate Macros for Each FORM Field

Alternatively, you can assign a separate Exit macro to each FORM field for which you want to change the tabbing order. Each macro contains an EditGoTo statement that moves the insertion point to the desired FORM field.

Tip: To easily identify each macro, give the macro a name that describes its functionality. For example, give the name "GoToSubject" to the Exit macro that moves the insertion point to the Subject FORM field.

The following sample Exit macro, named "GoToSubject", moves from the current FORM field to the "Subject" FORM field:

   Sub Main
      EditGoTo "Subject"
   End Sub

For information about how to do this in Word 97, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q159896
   TITLE     : WD97: How to Control the Tabbing Order in a Form

Additional query words: sequence jump around move Change tab forms tab order
Keywords          : kbmacro kbdtacode kbmacroexample winword macword word95 
Version           : WINDOWS:6.0,6.0a,6.0c,7.0,7.0a; MACINTOSH:6.0,6.0.1,6.0.1a
Platform          : MACINTOSH WINDOWS
Issue type        : kbhowto

Last Reviewed: April 9, 1999