Storing Macros in Templates

Written by Allen Wyatt (last updated April 5, 2025)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Excel in Microsoft 365


Tony has a question about the differences between macro storage in Word and Excel. In Word, macros can be stored in a document's template and you can attach a template to a particular document. Thus, Tony is able to maintain just one template and edit it to add new automation features to documents he may have created years ago. Tony wonders if there is a way to do the same in Excel so that all of his co-workers can utilize the macros stored in an Excel template on a network drive.

The short answer is that there is no way to do what you are describing. The reason is that there is an intrinsic difference between how templates are used in the two programs. In Word, a template is actively attached to a document and whenever a document is opened, the template attached to that document is also opened. If the template has changed since the last time the document was opened (for instance, if the template was updated to contain new macros), then those changes are immediately available within that document.

In Excel, templates aren't like that. True, you can create macro-enabled templates (XLTM files), and then create workbooks based on those templates. The macros in the template should end up as part of the workbook you create based on that template. But that is as far as it goes; there is no "active link" between a document and a template. If you later update the template with new macros, any workbooks previously created based on that template are not affected.

If you want to make constantly updated macros available to co-workers, there are three ways to go about doing so in the Excel environment. First, you can rely on the Personal.xlsb file. Any macros in this special workbook are available to the user because it opens whenever Excel is being used. You could set up a system to constantly update the Personal.xlsb workbook on every co-worker's system. The downside to this is that it is a pain to constantly update.

The second approach is to create a special macro-enabled workbook on a network drive that is accessible to all your co-workers. You might give it a special name, such as OurCompanyMacros.xlsm, and use it to do nothing except store your company macros. Teach all your co-workers to open this workbook whenever they use Excel, and then they will have access to any macros in the workbook. This is more manageable than the approach that relies on Personal.xlsb because you only need to update the macros in the one workbook and then all users can access them.

The third approach is to create a company add-in that contains your macros. How you create an add-in is too detailed for this tip, but you can find additional information in these ExcelTips:

https://excelribbon.tips.net/T008528
https://excelribbon.tips.net/T008529

The add-in could be stored on a network drive, and then users could install that add-in on their system and use all the macros it contains. When installing a network add-in, users are automatically given the option to copy the add-in to their local drive. If a user chooses to copy the add-in, that will defeat the ability to update the add-in and have the co-workers have access to the updated macros. The way around that is to develop some "check" in your macros to always make sure the current local add-in is the latest version. If it is not, your macro could prompt the user to perform whatever update process you might develop to make sure the add-in is up to date.

You can get just about as fancy as you want in developing and deploying add-ins. If you want more information about add-ins than you probably wanted, you might refer to this Microsoft website:

https://docs.microsoft.com/en-us/office/dev/add-ins/excel/

The bottom line is that because of the differences in how templates are conceived and implemented in Excel when compared to Word, it can be quite a bit harder to make sure that users of specific workbooks have access to updated macros for those workbooks.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (13712) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Excel in Microsoft 365.

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

Field Reference to Number of Prior Pages

Fields are used for all sorts of purposes in Word, but typically to provide some sort of dynamic information. This tip ...

Discover More

Displaying Images based on a Result

Got some images that you want to appear in a worksheet based on the result displayed in a cell? Figuring out how to ...

Discover More

Determining Differences Between Dates

Macros are often used to process the data in a worksheet. If that data includes dates that need to be processed, you'll ...

Discover More

Dive Deep into Macros! Make Excel do things you thought were impossible, discover techniques you won't find anywhere else, and create powerful automated reports. Bill Jelen and Tracy Syrstad help you instantly visualize information to make it actionable. You’ll find step-by-step instructions, real-world case studies, and 50 workbooks packed with examples and solutions. Check out Microsoft Excel 2019 VBA and Macros today!

More ExcelTips (ribbon)

Telling which Worksheets are Selected

If your macro processes information on a number of worksheets, chances are good that you need your macro to figure out ...

Discover More

Continuing Macro Lines

Sometimes a macro command line can get very, very long. This can make it hard to understand when you look at it a month ...

Discover More

Macros Run Slower in Newer Excel?

If you run a macro you used in an older version of Excel on a newer system, it may seem like the macro runs slower. Here ...

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 six more than 9?

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 ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu 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.