MS WORD setting the tab order using a single onexit macro

S

Steve

Hello,

I have designed a quotation form for my staff with around 50 various
formfields. I am having problems setting the tab order using the suggested
code below. Is it possible to assign a single onexit macro for various
formfields? Only four of the fields are visable here as the code would be too
large to post. Is this the correct code?


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 "Dropdown1"
StrFFldToGoTo = "Dropdown2"
Case "Dropdown2"
StrFFldToGoTo = "Dropdown3"
Case "Dropdown3"
StrFFldToGoTo = "Text1"
End Select
'... and go to it.
ActiveDocument.Bookmarks(StrFFldToGoTo).Range.Fields(1).Result.Select

End Sub
 
C

Charles Kenyon

I don't have your answer, but I would start by giving your formfields more
meaningful names or you are going to be lost in very short order.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide




--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 

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