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

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Revisit to Trapping Keystrokes In A Document (Word 2003/2007 VBA)

    Author
    Topic
    #445324

    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.

    Viewing 0 reply threads
    Author
    Replies
    • #1079550

      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.

    Viewing 0 reply threads
    Reply To: Revisit to Trapping Keystrokes In A Document (Word 2003/2007 VBA)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: