How to control the tabbing order in a form in Word 2000 or Word 2002 (212378)
The information in this article applies to:
- Microsoft Word 2002
- Microsoft Word 2000
This article was previously published under Q212378 For a Microsoft Word 98 Macintosh Edition version of
this article, see
182425. For a Microsoft Word 97 version of this article, see
159896. 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 a left-to-right, top-to-bottom order when you press TAB. To change the
default tabbing order, use the procedure described in the "More Information"
section of this article. MORE INFORMATIONMicrosoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers 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 requirements. Use one of the following methods as a
workaround. Method 1: Create a Single Exit Macro for All Form Fields Create a macro similar to the following example. For each form
field in your form, specify this macro as the exit macro. In the Select Case statement, list each form field for which you want to change the
tabbing order. NOTE: The bookmark name in each Case statement below should be in all lower case characters.
Sub TabOrder()
Dim sTabTo As String
Dim dlgForm As Dialog
' Unprotect the document.
If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect
End If
Set dlgForm = Dialogs(wdDialogFormFieldOptions)
' Reprotect the document preserving form field contents.
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End If
Select Case LCase(dlgForm.Name)
Case "cc"
sTabTo = "header"
Case "header"
sTabTo = "to"
Case "to"
sTabTo = "from"
Case "from"
sTabTo = "memo"
Case "memo"
sTabTo = "subject"
Case "subject"
sTabTo = "cc"
Case Else
End Select
Selection.GoTo What:=wdGoToBookmark, Name:=sTabTo
End Sub
Method 2: Create a Separate Macro for Each Form Field Create a new exit macro for each form field that contains a Selection.GoTo statement that moves the insertion point to the next form field
you want when you press the TAB key. TIP: To easily identify each macro, give the macro a name that
describes its functionality. For example, use the name GoToSubject for 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 GoToSubject()
Selection.GoTo What:=wdGoToBookmark, Name:="Subject"
End Sub
For additional information about using the sample code in
this article, click the article numbers below to view the articles in the
Microsoft Knowledge Base: 290140 OFFXP: How to Run Sample Code from Knowledge Base Articles
212536 OFF2000: How to Run Sample Code from Knowledge Base Articles
REFERENCESFor additional information, click the article number below
to view the article in the Microsoft Knowledge Base: 264707 WD: Form Fields in Table Are Tabbed in Reverse Order When Using Right-to-Left Features
Modification Type: | Minor | Last Reviewed: | 10/11/2006 |
---|
Keywords: | kbhowto kbmacro kbProgramming kbusage KB212378 |
---|
|