Storing Macros in Templates

Written by Allen Wyatt (last updated December 14, 2019)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, 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:

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:

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


Dissecting a String

Want to pull a string apart in a macro? It's easy using the string functions introduced in this tip.

Discover More

Extracting First and Last Words

When working with text phrases stored in cells, it might be helpful to be able to extract words from the phrase. In this ...

Discover More

WordTips Ribbon 2022 Archive (Table of Contents)

WordTips is a weekly newsletter that provides tips on how to best use Microsoft's word processing software. At ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More ExcelTips (ribbon)

Displaying the First Worksheet in a Macro

When creating macros, you often have to know how to display individual worksheets. VBA provides several ways you can ...

Discover More

Adding Leading Zeroes to ZIP Codes

Import a bunch of ZIP Codes into Excel, and you may be surprised that any leading zeroes disappear. Here's a handy little ...

Discover More

Relative References when Recording Macros

When you record a macro, make sure that you know how Excel is recording your cell movements. This tip explains the ...

Discover More

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.


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 4 + 0?

2019-12-17 11:49:35


Hi, I'm no longer working in an environment with a network server, but I could imagine that following options may work as well:
- in the Personal.xlsb you can in Visual basic tell to link under "Tools -References..." the file stored on the server.
- I think the even better approach would be to store an AddIn on the server and to load the AddIn directly from there. I don't think that all used AddIns have to be in the default folder for AddIns.

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

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.