How do I prevent a form user from entering a "return" character - it is
dropping the form line down and messes everything up. Also , if you limit
the form field to 10 text characters, can you size the form to 10 characters?
So that way the form is locked and doesn't change as the user enters the
information in the blank lines?
Tony Jollans - 30 Oct 2005 20:39 GMT
You can reassign the Enter key so that it does nothing ..
Sub DummyReturnKey()
End Sub
Sub ToggleReturnKey()
CustomizationContext = ActiveDocument
Set Key = FindKey(BuildKeyCode(wdKeyReturn))
If Key.KeyCategory = wdKeyCategoryNil Then
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyReturn), _
KeyCategory:=wdKeyCategoryCommand, _
Command:="DummyReturnKey"
Else
Key.Clear
End If
End Sub
The Toggle routine will toggle the effect of the return key - either normal
or assigned to the empty sub above. Use at appropriate points (or extract
appropriate code from it and use that at appropriate points) such as
document_open and document_close.
--
Enjoy,
Tony
> How do I prevent a form user from entering a "return" character - it is
> dropping the form line down and messes everything up. Also , if you limit
> the form field to 10 text characters, can you size the form to 10 characters?
> So that way the form is locked and doesn't change as the user enters the
> information in the blank lines?
Stefan Blom - 31 Oct 2005 12:01 GMT
See the following KB article:
How to code the ENTER key to move between form fields in a protected
form in Word
http://support.microsoft.com/default.aspx?scid=kb;en-us;211219

Signature
Stefan Blom
Microsoft Word MVP
> How do I prevent a form user from entering a "return" character - it
> is
[quoted text clipped - 5 lines]
> enters the
> information in the blank lines?
Stefan Blom - 31 Oct 2005 12:04 GMT
And for the second question, place the form field in a table cell with
fixed dimensions.

Signature
Stefan Blom
Microsoft Word MVP
> See the following KB article:
>
[quoted text clipped - 11 lines]
> > enters the
> > information in the blank lines?