Protecting Form from Carriage Returns

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I understand how to create a template and put in the text form fields, and I know that the person completing the form should hit TAB to move between the form fields, but if someone hits "Enter" instead of TAB, then I want to keep them from hitting "Enter" and inserting extra carriage returns in the form.
 
Thanks for the link. Not sure how to insert it into my template, but I'm learning. I want anyone that opens the template to have the macro running in the background so that when they press enter it moves to the next field similar to the tab key. I know they will have to enable macros if their security is set to medium, but that should be their only input.
Thanks again.
 
See http://www.gmayor.dsl.pipex.com/installing_macro.htm

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://www.mvps.org/word
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

Dwain said:
Thanks for the link. Not sure how to insert it into my template, but I'm
learning. I want anyone that opens the template to have the macro running
in the background so that when they press enter it moves to the next field
similar to the tab key. I know they will have to enable macros if their
security is set to medium, but that should be their only input.
 
Hi, Dwain,

For instructions on putting the macros into the template, follow the link at
the bottom of the article (which goes here:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;173707) or see the
equivalent article at
http://www.mvps.org/word/FAQs/MacrosVBA/CreateAMacro.htm.

The macros named AutoNew and AutoOpen run automatically when you create or
open any document based on the template, and AutoClose runs (surprise!) when
you close the document. Because of the keybinding, the EnterKeyMacro runs
every time you press the Enter key in that document.

If the template is stored in each user's User Templates folder (as shown in
Tools > Options > File Locations), they won't see the macro security
message. (In Word 2003, they would have to set an option to trust installed
templates in the Tools > Macro > Security dialog.)
 
Thanks again for the help, but when I try to use the template with the macro, I get an error and then when debug runs I get the following items highlighted:
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyReturn), _
KeyCategory:=wdKeyCategoryMacro, Command:="EnterKeyMacro"
When I close the file I get another error for the Autoclose. It is:
FindKey(KeyCode:=BuildKeyCode(wdKeyReturn)).Disable
I realize this is probably simple, but I haven't much experience writing or editing macros.
Thanks for your help.
 
Back
Top