List of Macro Shortcuts in All Open Workbooks

by Allen Wyatt
(last updated June 25, 2018)


If you develop a lot of macros, you may want to list all those macros along with the shortcut keys used to initiate them. Of course, coming up with the code to list the shortcut keys is the tricky part of this problem, as such an ability is not built into Excel directly. (You can do it in Word, but not in Excel. Go figure.)

The easiest way to do this would be to create a macro that exported each of your macros to a .bas text file, then read that text file to determine the shortcut keys. Why this is easiest is because the shortcut keys are not directly available to VBA, but they are written as part of the text file whenever you export macros.

For instance, when you export a macro to a .bas file, it will include lines similar to the following:

Attribute VB_Name = "Module1"
Attribute MyMacro.VB_Description = "My Description"
Attribute MyMacro.VB_ProcData.VB_Invoke_Func = "q\n14"

Your macro could read the .bas file (it is nothing but a text file) and parse what is written there to extract the macro's name and shortcut keys. In the above example, "Module1" is the module the code is in, "MyMacro" is the procedure name, "My Description" is the description for the procedure and "q" is the shortcut key. (The "\n14" seems to be there for all macros; what it signifies is unclear.)

Your code, to be effective, would need to loop through all the modules in a workbook, doing the export and parse steps to get the desired information.

Sound complex? It can be. It's a good thing that there is already a macro available that does all of this. Ivan Moala has written a free Excel add-in that does exactly what is described above. The add-in is available here:

The code is password protected but Moala has indicated elsewhere on the Internet that the password to access the code is "test." By unlocking the code, you can see exactly how he achieved his results and then create your own macro, or you can just modify his to make sure that whatever is printed matches your needs. For instance, if you want the macro to print the workbook name, module name, macro name, and shortcut key, then you could modify the code to do exactly that.

There is one gottcha that could bite you when using macros of this sort, as well. You need to make sure that you have your macro security set to the proper level to allow the type of access required for the macro to do its work. You do this by choosing, within Excel, Tools | Options | Security | Macro Security. You can then set the security level to the necessary setting: Trust Access VB Projects.

The code described so far allows you to get the desired information for a specific workbook. The next step, of course, is to make sure that the code is applied to each open workbook. This is relatively easy. If your code to process the macros in a single workbook is named something like ListKeys, then you can create a different macro that looks like this:

Sub ListAllKeys()
    Dim wkb As Workbook

    For Each wkb In Workbooks()
        Call ListKeys(wkb)
End Sub

The macro steps through all the open workbooks, passing each one's name to the ListKeys macro. This name can then be used by your ListKeys procedure to determine where it grabs its information from.


If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (3162) applies to Microsoft Excel 97, 2000, 2002, and 2003.

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. ...


Changing Body Text to a Heading

When working on a document in Outline view, you may need to change regular body text to a heading in the outline. It's ...

Discover More

Getting Rid of Fragment Warnings

Word provides a wide variety of tools that ostensibly help make you a better writer. One of those tools is the grammar ...

Discover More

Why Should I Upgrade?

As new versions of software are released, users are perpetually faced with the decision of whether to upgrade their ...

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

More ExcelTips (menu)

Hiding Macros

Need to hide some macros in your workbook? There are three ways you can do it, as covered in this discussion.

Discover More

Removing a Directory

Macros allow you to perform all sorts of file-related operations. One such operation allows you to delete a directory. ...

Discover More

Automating Copying Macros

You can manually copy macros from one workbook to another, but what if you want to automate the copying process? Here's ...

Discover More

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

View most recent newsletter.


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}] 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 2 + 0?

2017-07-04 09:43:31

as of today the cached version of the website is not dead, here the download link:

thx Prooffreader for the tip ;)

2014-05-09 03:08:47


It appears "
14" refers to CRTL

2013-09-06 12:23:43


There's a cached version of the web page available at:

2013-08-13 07:33:54


Unfortunately, as often happens on the internet when relying on someone else to host your content, the link is down.

This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

Newest Tips

FREE SERVICE: Get tips like this every week in ExcelTips, 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.