How to disable "office access key" in word RRS feed

  • Question

  • Is there a way how to disable "office access key" shortcuts in word either in addin code or maybe use some registry settings?

    I have created completely new ribbon GUI in adding, but there is still possibility to use keyboard shortcuts for "disabled" functionality. E.g. Pressing keys: "Alt", then "I" then "I" opens dialog for inserting hyperlink...

    I was able to disable "common" keyboard shortcuts in addin code using code like this:

    AppWord.FindKey[AppWord.BuildKeyCode(Word.WdKey.wdKeyAlt, Word.WdKey.wdKeyF10)].Disable(); 

    but these "office access key" shortcuts seems to be bulletproof...

    Tuesday, September 6, 2011 9:28 AM

All replies

  • The correct way would be to use Ribbon XML for your ribbon interface.

    In the Ribbon XML include a <commands> section (which comes before the <ribbon> section). Create a <command> element for every command you want to re-purpose (disable). Set the idMso attribute to that of the command and the enabled attribute to false.

    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Calvin_GaoModerator Wednesday, September 14, 2011 4:20 AM
    • Unmarked as answer by Andy Kovar Wednesday, February 15, 2012 10:30 AM
    Tuesday, September 6, 2011 1:23 PM
  • Thanks, but it seems it's not working.

    This is fragment from my Ribbon.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <customUI xmlns="" onLoad="OnRibbonLoad" xmlns:x="xyz">
            <command idMso="HyperlinkInsert" enabled="false"/>

    This correctly lead to disabling "Insert Hyperlink" in ribbon GUI, but still shortcut worked.

    How to emulate: In Word 2010 open a document a press: "Alt", then press "Alt+I"

    Wednesday, February 15, 2012 10:34 AM
  • Hi Andy

    <<This correctly lead to disabling "Insert Hyperlink" in ribbon GUI, but still shortcut worked.

    How to emulate: In Word 2010 open a document a press: "Alt", then press "Alt+I">>

    Ah. This is the old (pre 2007) menu shortcut and runs at a different level. I think the only thing you can do here is to provide a VBA macro that does nothing and remap that key combination to the macro.

    Assuming this is a COM or VSTO add-in, you'd want to:

    1. Create a Word template file (*.dotm)
    2. Add a VBA module to the template and put a VBA macro in it that's "empty":
      Sub NoMacro()
      End Sub

    3. Go to Options/Customize, click the button to "Customize" the keyboard shortcuts. From the list on the left, choose "Macros". From the list on the right, click on NoMacro. Make sure changes will be saved in this template. Click in the box for the new keyboard shortcut and press Alt+i. Click "Assign", then OK back out of the dialog boxes.

    4. Digitally sign the VBA project (Tools menu), save the template and close it.
    5. When your the Ribbon loads, have it also load this template (wdApplication.Addins object) from whatever file location you choose to save it (it can be anywhere on the local machine). Loading the template as an Add-in will bring the keyboard assignment into play and override the default assignment.

    Cindy Meister, VSTO/Word MVP

    Thursday, February 16, 2012 1:36 PM
  • Hi Cindy,

    Thanks for the answer, but unfortunately it didn't help.

    Using your steps I was only able to assign (disable) simple shortcuts like: Alt+I which is not the case. I need to disable "office access key" shortcuts like following:

    Alt, Alt+I


    Alt, Alt, I

    Since "they" claimed it's a support for users who were used to earlier office versions ( I thought it's possible to turn that off somehow easily...

    Thursday, February 16, 2012 3:12 PM