I know we can reporgram [Enter] to function as a [Tab] in a form but I want
to deactivate it all together within a 'form' protected section - is this
possible and what might the ramifications be?
MervB
Hi Merv,
Use the macros in
http://support.microsoft.com/?kbid=211219 but cut
down the first one like this:
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
' Leave out the part that moves to the next field
Else
' If the document is not protected for forms,
' insert a tab stop character.
Selection.TypeText Chr(13)
End If
End Sub
I haven't done any testing with this, but it doesn't appear to have
any nasty side effects. If the cursor is in a document that isn't
protected for forms, or it's in a nonprotected section of a partially
protected document, the Enter key will behave normally. If it's in a
field in a protected section of a forms document, then it will be a
dead key.
BTW, this question would have been more appropriate in one of the VBA
programming newsgroups.