Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, 2013, and 2016. If you are using an earlier version (Word 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Word, click here: Stopping Enter from being Pressed In a Form.
Written by Allen Wyatt (last updated July 12, 2021)
This tip applies to Word 2007, 2010, 2013, and 2016
Amy created an electronic form based on a table format so the entries are aligned. She included form fields in both text and number format, adding a maximum field length for each field. This prevents the person filling out the form from entering text beyond the maximum. However, the person can still press Enter and add blank lines to the form and cause it to be "distorted." Amy wonders how she can prevent users from pressing Enter and messing up the layout of her forms.
It is possible to disable the Enter key, but doing so disables it for the entire document, not just for the form. Also, the key would need to be disabled by using a macro. If the user disables macros by default (due to security settings or by explicitly disabling them when opening the document), then the Enter key would not be disabled. Because of these drawbacks, disabling the Enter key may not be the best way to approach this problem.
A better approach would be to modify how you set up your table; the one that contains your form fields. Follow these general steps:
Figure 1. The Table Options dialog box.
Figure 2. The Row tab of the Table Properties dialog box.
These steps won't stop someone from pressing Enter, but it will stop it from messing up your table format if they do press Enter. And, since the user won't be able to see what they type after pressing Enter, they'll quickly get the idea that they should not press the key.
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (9443) applies to Microsoft Word 2007, 2010, 2013, and 2016. You can find a version of this tip for the older menu interface of Word here: Stopping Enter from being Pressed In a Form.
Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!
Do you use Word to create printed forms? If so, here's some ideas and techniques you can use to make those forms look as ...
Discover MoreWhen you lock a document as a form, then Word limits what you can do with that document. That includes not being able to ...
Discover MoreYou know you want to use form fields in your document (they are essential in creating forms, after all) but you need to ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
2021-07-12 22:00:44
Phil Maier
Would it be possible to build a VBA userform to input the data and trap an 'Enter' key with the KeyUp or KeyPress events of the desired field of the userform and then transfer the 'cleansed' user input to the word form.
I have not had time to create this code but the strategy seems valid. What do others think?
Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments