Question re: the MVP article "How to set the tab order of a Word f

G

Guest

I have adapted an Omniform form into Microsoft Word 2002. I found that it
that needed to have the tab settings reset. I found the MVP article about
setting the tab order and followed the instructions in Method 2: "assign a
single OnExit macro to all your form fields". My form is a mixture of text
and check boxes. After completing the macro as instructed, I found that I
can tab to text boxes, but it will not tab to the check boxes. Below is the
macro with a sample of the fields listed. "ServiceAM1" and "ServicePM1" are
check boxes, the remaining fields are text boxes:
Please help me! I've been working on this all day and am at the end of my
rope. Thanking you in advance,
Leslie

Sub TabOrder()

Dim StrCurFFld As String, StrFFldToGoTo As String

'First get the name of the current formfield
If Selection.FormFields.Count = 1 Then
'No textbox but a check- or listbox
StrCurFFld = Selection.FormFields(1).Name
ElseIf Selection.FormFields.Count = 0 And Selection.Bookmarks.Count > 0 Then
'Textbox
StrCurFFld = Selection.Bookmarks(Selection.Bookmarks.Count).Name
End If

'Then find out which formfield to go to next ...
Select Case StrCurFFld
Case "Name"
StrFFldToGoTo = "ClientID"
Case "ClientID"
StrFFldToGoTo = "ServiceMonth1"
Case "ServiceMonth1"
StrFFldToGoTo = "ServiceDay1"
Case "ServiceDay1"
StrFFldToGoTo = "ServiceYear1"
Case "ServiceYear1"
StrFFldToGoTo = "ServiceHour1"
Case "ServiceHour1"
StrFFldToGoTo = "ServiceMinute1"
Case "ServiceMinute1"
StrFFldToGoTo = "ServiceAM1"
Case "ServiceAM1"
StrFFldToGoTo = "ServicePM1"
End Select
'... and go to it.
ActiveDocument.Bookmarks(StrFFldToGoTo).Range.Fields(1).Result.Select

End Sub
 
B

Bill Coan

Hi Leslie,

Try changing the final line of code to the following, and see if it works
any better:
ActiveDocument.Bookmarks(StrFFldToGoTo).Range.Fields(1).Select

You might even try:
ActiveDocument.Bookmarks(StrFFldToGoTo).Select


Bill Coan
(e-mail address removed)
 
B

Bill Coan

Hi Leslie,

Try changing the final line of code to the following, and see if it works
any better:
ActiveDocument.Bookmarks(StrFFldToGoTo).Range.Fields(1).Select

You might even try:
ActiveDocument.Bookmarks(StrFFldToGoTo).Select


Bill Coan
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top