Results 1 to 6 of 6
  1. #1
    Star Lounger
    Join Date
    Dec 2003
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Enter key as keyboard short cut? (Word 2000)

    Is there a way to assign the Enter key as a keyboard shortcut?
    I want to run a series of macros at the start of each new paragraph.

    Thanks,
    Shabtai

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

    Re: Enter key as keyboard short cut? (Word 2000)

    Be very careful! I have an uneasy feeling about hijacking the Enter key. The following code seems to work, but I haven't tested it extensively:

    Application.KeyBindings.Add wdKeyCategoryMacro, "YourMacroName", wdKeyReturn

    This will invoke the YourMacroName macro when the user presses Enter. Make sure to include something like Selection.TypeParagraph in this macro, otherwise the user won't be able to create a new paragraph any more!

  3. #3
    Star Lounger
    Join Date
    Dec 2003
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Enter key as keyboard short cut? (Word 2000)

    And how would I restore the Enter key to just enter a new paragraph? (i.e. How do I turn off what I have below?)

    Thanks,
    saturn

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Enter key as keyboard short cut? (Word 2000)

    If you search the Keybindings object in the VB Editor (just highlight it in your code module and press F1) there should have a corresponding method to delete the key assignment.

    You didn't state in your original post, but if this is meant to apply only to one document or template, you may be able to limit the key assignment accordingly. Word has a setting called CustomizationContext that I would guess would control this, but I have only used it with toolbars and not keyboard shortcuts.

    (In reading this, I realize it could be considered gibberish if you haven't done any VBA programming. Sorry about that, it's an obscure set of topics!)

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

    Re: Enter key as keyboard short cut? (Word 2000)

    Removing is easier:
    - Select Tools | Customize...
    - Click Keyboard...
    - Select Macros in the Categories list.
    - Select your macro in the Macros list..
    - Select Return in the "used shortcuts" list (or something similar)
    - Click Remove.

  6. #6
    Star Lounger
    Join Date
    Dec 2003
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Enter key as keyboard short cut? (Word 2000)

    The proper line of code to do this is:
    FindKey(BuildKeyCode(wdKeyReturn)).Disable

    Thanks,
    Saturn

Posting Permissions

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