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

Merging Graphics into Word Documents

Ever want to expand the mail merge feature to include graphics? Merging graphics into your document is easy but requires ...

Discover More

Word 2013 Indexes and Special Tables (Table of Contents)

One of the finishing touches used in some types of documents are an index or a special table, such as a table of ...

Discover More

Understanding the Lock Screen

Start up your Windows system, and chances are good that you'll see the Lock Screen almost immediately. Since this is the ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

More ExcelTips (menu)

Displaying a Set Column Range

Do you want to display a particular range of columns within the Excel window? Here's a couple ways you can accomplish the ...

Discover More

Updating Automatically When Opening Under Macro Control

If your workbook contains links, you are normally given the opportunity to update those links when you open the workbook. ...

Discover More

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
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 two more than 7?

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.