Removing Shortcuts for Macros

Written by Allen Wyatt (last updated August 6, 2024)
This tip applies to Word 2007 and 2010


5

Word doesn't show the keyboard shortcuts that Barry has associated with macros, so he wonders how he is supposed to remove the shortcuts. He has read about how he is supposed to remove keyboard shortcuts associated with macros (i.e., Office button | Options | Customize | Keyboard Customize; select Macros on the left, and select a given macro on the right). However, the "current keys" box remains blank when Barry selects a given macro, even though when editing he can press the shortcut sequence and the macro runs. He wonders how he can delete the shortcut associated with a macro since it's not showing up in the "current keys" box.

This does, indeed, seem to be a problem with Word. One can assume that it will be fixed in a future update to the program, but that doesn't help with getting the shortcut removed now. The following general steps may help:

  1. Display the VBA Editor.
  2. Copy the macro code associated with the shortcut.
  3. Paste the macro code into a Notepad document.
  4. Delete the macro code from the VBA Editor.
  5. Save and close the document.
  6. Restart Word.
  7. Open the document.
  8. Try the shortcut.
  9. Save and close the document.
  10. Exit Word.

The purpose of these steps is to force Word to conclude that the macro associated with the shortcut is no longer available, and thus delete the shortcut. After these steps, you should theoretically be able to go back into the VBA Editor and put the macro code back into it, and the shortcut should be gone.

If it is not gone, then the problem may best be solved by fiddling around with the Normal template. Create a new, empty template (using a different name than Normal), and then transfer all your macros and styles from Normal to the new template. Then, rename Normal to something else and rename the new template as your Normal template. When you restart Word, you then have all your macros and styles, but any custom shortcuts should now be gone. (They are stored in the Normal template, but there is no easy way to transfer them from one template to another.)

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (11919) applies to Microsoft Word 2007 and 2010.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Setting Denominator Depth Spacing in the Equation Editor

How to change the distance between a fraction bar and the baseline of the number below it.

Discover More

Entering Data as Thousands

There are many different ways you may need to enter data in a worksheet. For instance, you might want to enter data in ...

Discover More

Using Call to Run VBA Macros

An elegant way to run macros from within macros is to use the Call statement. In order to use it, you need to provide a ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More WordTips (ribbon)

Removing a Macro from a Shortcut Key

Associate a macro with a shortcut key, and at some time you may want to break that association. (Perhaps so the shortcut ...

Discover More

Changing the Format of Existing Dates

There are a myriad of ways in which a date can be formatted: day first, month first, number of digits in the year, etc. ...

Discover More

Converting Numbers to Strings

VBA is great at working with both strings and numbers. At some point, you may have a number you need to convert to a ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is nine minus 1?

2024-08-07 10:03:28

Andrew

Or, better than the KeyBindings Collection you could use the KeysBoundTo collection (see https://learn.microsoft.com/en-us/office/vba/api/word.keysboundto), with which I was previously unfamiliar, to obtain all of the KeyBinding objects assigned to a command, style, macro, or other item in the current context. Based on the example in that link, you should be able to remove the keys from a macro like this:

CustomizationContext = NormalTemplate
For Each myKey In KeysBoundTo(KeyCategory:=wdKeyCategoryMacro, Command:="MacroName")
myKey.Clear
Next myKey


2024-08-07 09:48:48

Andrew

Or, in VBA, you could use the KeyBindings collection to obtain the KeyBinding object for the key the macro is bound to, and then execute its .Clear method, which "Removes the specified key binding from the KeyBindings collection and resets a built-in command to its default key assignment." Haven't tested this though.

Also note, the KeyBindings.ClearAll command "Clears all the customized key assignments and restores the original Microsoft Word shortcut key assignments." I do use this with a custom macro that then rebinds my custom assignments - which I use a couple times a year when Word somehow loses track of one or more of my bindings - saving me *much* grief!

Andy.


2024-08-06 06:38:14

Dr. Bartolo

The tip says that "there is no easy way to transfer [shortcuts] from one template to another" but I think that this may be incorrect.

Word allows one to export "Office customizations" and I believe that these small files include shortcuts, although I am not 100% sure. Once exported these files can also later be imported, although in my experience this sometimes does not work, for reasons I have never figured out - or tried to since I have always found ways around the issue.

The place to export (and import) customizations in Word (and it is similar in all other Office programs) is: Office button | Options | Customize Ribbon | Import/Export. This is aimed at backing up the the ribbon and quick access toolbar, but as I said I think it may also include shortcuts.

I should be interested to know from others if this workaround works for shortcuts as well as for the ribbon and quick access toolbar.


2017-08-17 05:32:43

Ethan Hack

I can see keyboard shortcuts for macros, so this is not a universal problem. Could there be something in Word configuration that causes it?


2012-07-16 16:36:34

Derek Brown

Maybe it varies with the version of Word being used, but I've always found that changing the name of the macro cuts the link.


This Site

Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.

Videos
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.