Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Jun 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Revisit to Trapping Keystrokes In A Document (Word 2003/2007 VBA)

    Greetings,

    I need to write a VBA event handler to trap the return and tab keys in Word.
    Though I can cope with using simple API calls as such, I am totally lost when it comes to trying to create this event handler.
    Does anyone know where I can get any examples of event handlers using SetWindowsHookEx from VBA.

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

    Re: Revisit to Trapping Keystrokes In A Document (Word 2003/2007 VBA)

    You don't need Windows API calls to do that. You can use KeyBindings.Add to assign a macro to the wdKeyReturn key, and another one to the wdKeyTab key.
    Look up KeyBindings in the Word VBA help.

  3. #3
    Star Lounger
    Join Date
    Jun 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Revisit to Trapping Keystrokes In A Document (Word 2003/2007 VBA)

    Boy was I on the wrong track! Thanks Hans.

Posting Permissions

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