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

Finding a Lost Menu Bar

Once in a while Word can get confused and stop displaying an object you need to fully use Word. If your menu bar suddenly ...

Discover More

Inserting a Section Mark

Section marks are used regularly in the writings of some industries, such as in legal documents. If you need a way to ...

Discover More

ISO Week Numbers in Excel

Work in an industry that uses ISO standards when it comes to working with dates? You'll love the formula in this tip ...

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)

Selecting Columns in VBA when Cells are Merged

If you have a macro that selects different columns in a worksheet while processing information, you may get some ...

Discover More

Determining the Hour of the Day

Need to know the current hour of the day? You can derive the information in your macros by using the Hour function, as ...

Discover More

Saving a Workbook in a Macro

Does your macro need to make sure that the workbook being processed is saved to disk? You can add the saving capability ...

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