Automatically Opening Macro Workbooks when Using a Shortcut Key

Written by Allen Wyatt (last updated March 28, 2020)
This tip applies to Excel 97, 2000, 2002, and 2003


Inna notes that Excel allows her to assign shortcut keys to my macros. However, it looks like the shortcuts will only work if they refer to a macro in an open workbook. She usually has her macros stored in a separate workbook. If a macro is assigned to a toolbar button (or an option on the Quick Access toolbar), the workbook containing the macro is automatically opened so it can be run. This does not happen if Inna uses a keyboard shortcut for the same macro; pressing the shortcut won't load the workbook that contains the macro. She wonders if there is a way around this.

This problem is caused by the fact that Excel stores a fully qualified path to a macro as part of its toolbar info (that means it includes the name of the workbook in which the macro is stored), but it doesn't with the shortcut key info—that only has the macro name itself. This means that a shortcut doesn't know how to find a macro unless it is in a workbook that is open.

The easiest way around the problem would be to move the macros to the Personal.xlsm (or, in older versions of Excel, Personal.xls) workbook. This workbook is loaded automatically loaded when Excel is started, so the macros would always be available and the shortcut keys always work. Detailed information on the workbook can be found here:

http://office.microsoft.com/en-us/excel-help/deploy-your-excel-macros-from-a-central-file-HA001087296.aspx

Of course, you can bypass the Personal.xlsm approach by simply moving the workbook containing the macros to the Startup folder used by Excel. Anything in the folder is automatically opened when you first start Excel, which means that the macros in those workbooks would also be accessible.

The workbook containing your macros could also be compiled into an Excel add-in, which would be available at all times. (How you create and use an add-in has been covered in other ExcelTips.)

Note:

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 (6401) 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. ...

MORE FROM ALLEN

Using Text As a Page Border

Word allows you to add page borders to a document, but you might find the options in this area too limiting. What if you ...

Discover More

Searching for Line Breaks

If you need to find where line breaks are located in cells, there are a couple of ways you can proceed. Here's a quick ...

Discover More

Moving and Selecting Rows

If you need to move down a row and then select that row, you may wonder if there is a shortcut to handle such a ...

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)

Getting Rid of the "Enable Macros" Notice

Do you get tired of the dialog box that says "do you want to enable macros" that is displayed when you open a workbook. ...

Discover More

Delimited Text-to-Columns in a Macro

The Text-to-Columns tool is an extremely powerful feature that allows you to divide data in a variety of ways. Excel even ...

Discover More

Fixing Macro Button Behavior in Protected Worksheets

When working with macro buttons, you may run into some bizarre behavior related to the macros without really ...

Discover More
Subscribe

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

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


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
Subscribe

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.