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

Saving Documents Faster

If you are using Word versions 97 through 2003, there's a setting you can make that will allow you to save your documents ...

Discover More

Sorting a Text Selection

Word gives you the option to sort selected groups of text. You can do text, date or number sorts on whole paragraphs or ...

Discover More

Direction Arrows Confused

What do you do if you open a document, only to find that the arrow keys don't work the way that they should? The first ...

Discover More

Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

More ExcelTips (menu)

Displaying Messages When Automatic Data Changes

It is possible to develop macros that update the information in your worksheets automatically. In such instances, you may ...

Discover More

Determining Mouse Cursor Coordinates On a Graphic

Add a graphic to a worksheet as part of an Image object, and you can use some very handy event handlers to figure out the ...

Discover More

Understanding the If ... End If Structure

One of the most basic of programming structures is the conditional structure: If ... End If. This tip explains how this ...

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