Results 1 to 9 of 9
  1. #1
    New Lounger
    Join Date
    Sep 2006
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Enter Key only Tabs through Fields Macro needed. (

    My college has asked me to do some forms in Word that were formerly on paper. I want to know if there is any macro that anyone has heard of that gives the "Enter" key tab properties. Currently I have a disclaimer at the top of every form that tells the user not to use the "Enter" key but to just use the "Tab" key to tab through the form fields. I would love to lose that disclaimer and give the "Enter" key only tab properties.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Enter Key only Tabs through Fields Macro needed. (


  3. #3
    New Lounger
    Join Date
    Sep 2006
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Enter Key only Tabs through Fields Macro needed. (

    I have gone through that article very closely and it looks like I only need to add the first three macros to apply tab functionality to the enter key. The last one looks like it is just a macro to undo the first three. I don't see anything in any of the three macros that requires a user input (like a bookmark name etc) yet I cannot get this to work. I honestly did try a few things but just can't get it to work. Is there any info tied to my project that needs to be entered to modify the macros?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Enter Key only Tabs through Fields Macro needed. (

    The method works OK if I try it. Make sure that macro security is not set to High. Medium is the best setting; click Yes when prompted to enable macros in the document. (If the macros are in a template in your Templates folder, you can avoid the prompt by ticking the check box "Trust installed templates and add-ins" in the Trusted Sources tab of Tools | Macro | Security).

    I have attached a simple demo. Does it work for you?
    Attached Files Attached Files

  5. #5
    New Lounger
    Join Date
    Sep 2006
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Enter Key only Tabs through Fields Macro needed. (

    I have entered the code that you had associated with your attachment (thank you for that!) and I found that it has the "Option Explicit" statement at the top which I take to mean that you must declare all variables. I have existing code which I have included in a previously created form that has macros written explicitly to retrieve user info information so that they can electronically sign Word forms that were previously all on paper. I am sending an attachment as the one that I had previous to trying the EnterKeyMacro and shows what happens after I put that code in. Thank You Very Much for Your Time and Help!
    Attached Files Attached Files

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Enter Key only Tabs through Fields Macro needed. (

    1) The line Option Explicit may only occur at the top of a module, not after other code.
    2) You should place the code in a standard module (the kind you create by selecting Insert | Module in the Visual Basic Editor), not in ThisDocument.
    3) For the code to work, you must specify a bookmark name for each form field in the document. Many of the form fields in your document don't have a bookmark name. To correect this, unprotect the document, then double click each form field in turn, and specify a unique name. When done, re-protect the document.
    4) You don't need to specify EnterKeyMacro in the On Enter or On Exit properties of the form fields.

  7. #7
    New Lounger
    Join Date
    Sep 2006
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Enter Key only Tabs through Fields Macro needed. (

    I have gotten it to work but the only problem that I am having now is that the Enter key will tab through the fields when it gets to the last field the cursor jumps to one of the buttons and won't either go further or jump back up to the first field again. Any suggestions?
    Attached Files Attached Files

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Enter Key only Tabs through Fields Macro needed. (

    The problem is that the last four form fields in your document can't be filled in, so you have to jump back from the last formfield that the user can fill in: Text7. So change

    If ActiveDocument.FormFields(myFormField).Name <> _
    ActiveDocument.FormFields(ActiveDocument.FormField s.Count).Name Then

    to

    If ActiveDocument.FormFields(myFormField).Name <> _
    "Text7" Then

  9. #9
    New Lounger
    Join Date
    Sep 2006
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Enter Key only Tabs through Fields Macro needed. (

    You are completely a lifesaver Hans. Thank You for your help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •