none
Keyboard shortcuts in Word 2007

    Question

  • Hi,

    I am new to VB and Visual Studio programming, and I am working on a Text to Speech toolbar written as a "Visual Basic addin for Word 2007".  I am trying to create keyboard shortcuts for my "play" "pause" and "stop" event Subs.  How can this be done? 

    Thanks,
    Jake Friedman

    Sunday, June 06, 2010 11:16 PM

Answers

  • I am new to VB and Visual Studio programming, and I am working on a Text to Speech toolbar written as a "Visual Basic addin for Word 2007".  I am trying to create keyboard shortcuts for my "play" "pause" and "stop" event Subs.  How can this be done? 

    Hi Jake

    If we may assume you're creating a RIBBON XML part for your Add-in, then you can assign keyboard shortcuts to the Ribbon, as part of the Ribbon XML. Use the keytip attribute. Note that in order to use these, the user must press Alt, then the keytip for the appropriate Ribbon TAB control, then the shortcut for the button control.

    Word does not support direct mapping of its keyboard shortcuts to anything but internal VBA "Public Sub" procedures. In order to link these with code in an outside DLL, you'd need a "stub" VBA macro that calls the procedure in a COM Visible DLL with COM Visible procedures. It's not clear whether you're using VSTO or are implementing the IDT2Extensibility interface directly. If you are making a VSTO add-in then the technique for linking up to VBA macros is in the MSDN documentation.


    Cindy Meister, VSTO/Word MVP
    Tuesday, June 08, 2010 7:45 AM
    Moderator

All replies

  • Click on the Office Button and then on Word Options and then on Customize and then on the Customize button alongside the Keyboard shortcuts item at the bottom of the left side of the dialog and then scroll down to Macros in the Categories window and select your Subs in the Macros window and then click in the Press new shortcut key control and press the desired key sequence and then click on the Assign button.

    -- Hope this helps.

    Please reply to the newsgroup unless you wish to avail yourself of my
    services on a paid consulting basis.

    Doug Robbins - Word MVP, Posted via the NNTP Bridge

    "Jake Friedman" wrote in message news:262b7357-1abe-4341-9b17-5aaa7d7921a5@communitybridge.codeplex.com...

    Hi,

    I am new to VB and Visual Studio programming, and I am working on a Text to Speech toolbar written as a "Visual Basic addin for Word 2007".  I am trying to create keyboard shortcuts for my "play" "pause" and "stop" event Subs.  How can this be done?

    Thanks,
    Jake Friedman


    Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org
    Monday, June 07, 2010 3:29 AM
  • Is there any way to do this with VB code from inside Visual Studio?  I am trying to make it so that once my addin is installed via ClickOnce, keyboard shortcuts are mapped to my buttons/Subs.  

    Also, looking in the menu you listed, I dont see my Subs listed, only the test macros I created within Word, not my toolbar's Subs created in VS 2008.  I created this addin as a "Word 2007 VB addin" in VS 2008 if that is relevant.

    Monday, June 07, 2010 8:23 PM
  • I am new to VB and Visual Studio programming, and I am working on a Text to Speech toolbar written as a "Visual Basic addin for Word 2007".  I am trying to create keyboard shortcuts for my "play" "pause" and "stop" event Subs.  How can this be done? 

    Hi Jake

    If we may assume you're creating a RIBBON XML part for your Add-in, then you can assign keyboard shortcuts to the Ribbon, as part of the Ribbon XML. Use the keytip attribute. Note that in order to use these, the user must press Alt, then the keytip for the appropriate Ribbon TAB control, then the shortcut for the button control.

    Word does not support direct mapping of its keyboard shortcuts to anything but internal VBA "Public Sub" procedures. In order to link these with code in an outside DLL, you'd need a "stub" VBA macro that calls the procedure in a COM Visible DLL with COM Visible procedures. It's not clear whether you're using VSTO or are implementing the IDT2Extensibility interface directly. If you are making a VSTO add-in then the technique for linking up to VBA macros is in the MSDN documentation.


    Cindy Meister, VSTO/Word MVP
    Tuesday, June 08, 2010 7:45 AM
    Moderator
  • I'm just replying to this in case anyone else pops into this thread. I created a Word add-in as a global template and wanted to allow the user to assign keyboard shortcuts. Like Jake, I couldn't find any of my macros in the macros list, and thought it wasn't possible. However, after trying Doug's instructions again, I realized that I needed to change the 'Save changes to' selection from Normal to the name of my add-in. Then, my public subs showed up in the macro list.

    I don't know how this works with VSTO add-ins, so it might not be relevant, but since I came here looking for help with my global template I thought perhaps someone else might as well.

    Tuesday, December 11, 2012 3:47 PM
  • <<I don't know how this works with VSTO add-ins...>>

    It's not possible with VSTO (COM) add-ins, only with VBA.


    Cindy Meister, VSTO/Word MVP, my blog

    Tuesday, December 11, 2012 4:09 PM
    Moderator