WD: Form Fields in Table Are Tabbed in Reverse Order When Using Right-to-Left Features (264707)



The information in this article applies to:

  • Microsoft Word 2002
  • Microsoft Word 2000

This article was previously published under Q264707

SYMPTOMS

When a document contains a right-to-left table with form fields, the form fields are tabbed through from left-to-right when the document is protected as a form.

WORKAROUND

To work around this problem, use one of the following methods to move between form fields.

Method 1: Use SHIFT+TAB

Press SHIFT+TAB to move to the next form field, or press TAB to move to the previous form field.

Method 2: Use the Mouse

Click the mouse on the next form field that you want to move to.

Method 3: Use a Macro to Control the Tab Order

Microsoft 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.
For more information about how to use the sample code in this article, click the article number below to view the article in the Microsoft Knowledge Base:

212536 OFF2000: How to Run Sample Code from Knowledge Base Articles

Use an exit macro that is assigned to a specific form field to specify which form field to go to next. To do this, follow these steps:
  1. Open your Word form.
  2. On the Forms toolbar, click Protect Form to unprotect the form.
  3. On the Tools menu, point to Macro, and then click Visual Basic Editor (or press ALT+F11).
  4. In the project for your forms document, insert a new code module. To insert a new module, click Module on the Insert menu.
  5. At the top of the new module code sheet, create the following macro code:
    Public Declare Function GetKeyboardState Lib "user32" _
       (pbKeyState As Byte) As Long
    Public Declare Function GetAsyncKeyState Lib "user32" _
       (ByVal vKey As Long) As Long
    Public Const VK_Tab = &H9
    Public Const VK_Shift = &H10
    					
  6. Create an exit macro for each of your form fields, similar to the following sample macro:
    Sub ThisFieldName_Exit()
    
       Dim RealNext As Variable
       Dim RealPrev As Variable
       Dim TabState As Variable
       Dim ShiftState As Variable
    
       RealNext = ActiveDocument.FormFields("NextFieldName").Name
       RealPrev = ActiveDocument.FormFields("PreviousFieldName").Name
       TabState = GetAsyncKeyState(VK_Tab)
       ShiftState = GetAsyncKeyState(VK_Shift)
    
       If TabState Then
          If ShiftState Then
             Selection.GoTo What:=wdGoToBookmark, Name:=RealPrev
          Else
             Selection.GoTo What:=wdGoToBookmark, Name:=RealNext
          End If
       End If
    
    End Sub
    						
    NOTE: In the individual macros, replace "ThisFieldName", "NextFieldName", and "PreviousFieldName" with the correct names of the current, the next, and the previous form field in logical (right-to-left) order. Create a macro for every form field that is located in a right-to-left table.
  7. Assign the exit macros to each of your form fields. To do this, double-click a form field to display the Text Form Field Options dialog box. In the Exit list box (under Run macro on), select the corresponding macro, and then click OK.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

For more information about the right-to-left features in Word, click Microsoft Word Help on the Help menu, type right-to-left in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned.

Modification Type:MajorLast Reviewed:6/17/2005
Keywords:kbForms kbnofix kbprb kbtable KB264707