How to create a command in VSTO RRS feed

  • Question

  • I created a Ribbon. There's a button. I'd like to associate a hotkey with it. If I go to Word / Options / Cutomize Ribbon / Keyboard shortcuts Customize... / Categories and select my Ribbon Tab, the command listbox is empty. I don't see any way in my Ribbon how to associate it with Command, etc.


    Thursday, January 5, 2017 2:13 PM

All replies

  • Hi,

    >>I'd like to associate a hotkey with it

    We need to assign the keytip in the ribbon_load event.

    Since the ribbon is created from the add-in, if we want to set some properties, we need to design it in the add-in project. We are unable to manually set properties for custom controls by Office application.

           private void Ribbon1_Load(object sender, RibbonUIEventArgs e)


                button1.KeyTip = "G";




    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Friday, January 6, 2017 3:02 AM
  • Thank you. But there should be a way to create a command and associate it with Ribbon button. I know third party Word Add-ins that have commands for each of their own Ribbon buttons.
    Friday, January 6, 2017 9:53 AM
  • Does your custom button invoke a macro? If it does, assign the custom keystroke to the macro being called.

    I'm not aware of a method to assign a keystroke to a ribbon button... AFAIK you have to assign it to the underlying callback (i.e. the function function being invoked.)

    Hope this helps

    Kind Regards, Rich ...

    Friday, January 6, 2017 1:06 PM
  • It doesn't call a macro. It's a call of an add-in method.


    Friday, January 6, 2017 1:37 PM
  • You need to specify the KeyTip attribute or use the getKeyTip callback in the Ribbon XML. 

    KeyTips are the keyboard shortcuts that appear on the Ribbon when you press the ALT key. You can assign your own KeyTips by using the keytip and getKeytip attributes. (The getKeytip attribute supplies the name of a callback procedure that provides the KeyTip.)

    If your KeyTips conflict with built-in controls or KeyTips from other add-ins, they might be assigned non-conflicting values automatically. KeyTips for groups, as a rule, should start with the letter "Z".

    Read more about the Fluent UI (aka Ribbon UI) in the following series of articles:

    Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)

    Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)

    Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)

    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    Friday, January 6, 2017 3:08 PM