Is there a way to disable the Enter key in a Word template Form Fi

D

daveocampo

Hi,

I created a Word document template (.dot) with Form Fields, then I saved the
template in Protected mode and restrict the user to only allow Filling-In the
Forms Fields; however, if the user hits the Enter key, the form will generate
a line break and distort the standardized document template. Is there a
macro or function in Word to disable the Enter key in a .dot form field? If
not, maybe MS Offfice Development Team can add this feature to the Form Field
Propeties dialog box. Thanks!

David
 
D

daveocampo

Dear Suzanne,

Thank you for the macro. It works great except there is a bug report.

After exiting the template in Word 2000, the following Microsoft Visual
Basic runtime error box appears:

Run-time error '5980':

The context cannot be modified.

If you click on the "Debug" button it yellow highlights the macro script for
macro #4, the "AutoClose" macro:

FindKey (KeyCode:=BuildKeyCode(wdKeyReturn)).Disable

The other option is to click the "End" button.

Thanks for your help!

Dave
 
D

daveocampo

Dear Suzanne,

I was able to resolve the "bug" issue. It appears the bug was just in the
first template I created which ran the macro. It is working fine now.
Thanks!!

Dave
 
D

daveocampo

Hello Suzanne,

One follow-up question: I added the macro to my document and then saved it
as a template document. The macro works perfectly. This form I created will
be used by employees outside my organization. It is a standardized form so I
don't want them adding extra lines of text or exceeding the form field length
properties. The macro prevents all of these issues, provided the user
ENABLES the macro. The downside is the user has the option to DISABLE the
macro as part of Microsoft's virus macro security warning. Is there a way to
include in the template an "abort the session" macro if the user selects to
disable the EnterKey macro? Thanks!

Dave
 
S

Suzanne S. Barnhill

If a user disables macros, then I don't imagine there's any way for ANY
macro to run. You might be better off just using an Exact row height
instead.
 
C

Charles Kenyon

One level of protection would be to have the new document blank unless
macros are enabled. You use an AutoNew macro to actually create the form
(possibly from an AutoText entry). You could have a message display in the
no macros enabled version of the form that says it will not work unless
macros are enabled.

This is easy to get around or defeat but will work for most users.
--
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

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
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.
 
D

daveocampo

Thank you Suzanne.

Suzanne S. Barnhill said:
If a user disables macros, then I don't imagine there's any way for ANY
macro to run. You might be better off just using an Exact row height
instead.
 
D

daveocampo

Thank you Charles.

Charles Kenyon said:
One level of protection would be to have the new document blank unless
macros are enabled. You use an AutoNew macro to actually create the form
(possibly from an AutoText entry). You could have a message display in the
no macros enabled version of the form that says it will not work unless
macros are enabled.

This is easy to get around or defeat but will work for most users.
--
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

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
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.
 
C

ClassyIrish

Hi, I have followed all of the above, I have office 2003, this macro isn't
working, or I am not doing something correct. In the text form field, I am
selecting the second macro on entering and exiting. Do I need all four of
the macros? Or should I just go to 6.0 where it was 'just there'? I am
frustrated because of the concern that when hitting the enter key it gives a
line break and messes with the original form, I just want it to be easy, and
it doesn't seem to be. Any help would be so greatly appreciated.

Thanks
Marguerite
 
C

ClassyIrish

Yes, Doug, I am. I am on a deadline, and thought I was pretty good at this,
but finding out I am not. Any help would be appreciated. I not only do not
want line breaks, but I have inserted text boxes with a text link so that if
more information is typed than there is room for in the text box, it will
flow over to another page. Works, UNTIL I protect the form, then you can't
even get into the darn text box to type.
 
Top