OK, so I'm trying to get these macros to work as per
http://support.microsoft.com/kb/211219.
I'm still having trouble getting this to work. I have several text form
fields named text5, text6, text7 and so forth.
I named them in the bookmark section of the text fields properties ( I guess
that is how I am suppose to do it?). In the SubEnterKeyMacro I replaced
myformfield with text5 like so:
Sub EnterKeyMacro()
' Check whether the document is protected for forms
' and whether the protection is active.
If ActiveDocument.ProtectionType = wdAllowOnlyFormFields And _
Selection.Sections(1).ProtectedForForms = True Then
' Retrieve the bookmark of the current selection.
' This is equivalent to the name of the form field.
text5 = Selection.Bookmarks(1).Name
' Go to the next form field if the current form field
' is not the last one in the document.
If ActiveDocument.FormFields(text5).Name <> _
ActiveDocument.FormFields(ActiveDocument.FormFields.Count) _
.Name Then
ActiveDocument.FormFields(text5).Next.Select
Else
' If the current form field is the last one,
' go to the first form field in the document.
ActiveDocument.FormFields(1).Select
End If
Else
' If the document is not protected for forms,
' insert a tab stop character.
Selection.TypeText Chr(13)
End If
End Sub
It seems to want to work, as in, I can enter data in the first field (text5)
and press enter and it moves to the next text field.
From there (text6) when enter is pressed I get an error: The requested
member of the collection does not exist.
I know I need to add additional code for my remaining text fields but do not
know how. Also, after pressing enter on the first text field it won't let me
go back to that field, as in, clicking in the text box it immediately moves
the cursor to the next text box?
Can someone help? thanks