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

Getting Word to Remember the Default Date and Time Format

One way to insert the current date into your document is to use the Date and Time dialog box. The Default button in the ...

Discover More

Avoiding Rounding Errors in Formula Results

Some formulas just don't give the results you expect. Sometimes this is due to the way that Excel handles rounding. ...

Discover More

Searching and Replacing Graphics

Got a bunch of graphics in a document that need replacing? (Perhaps you need to replace an old logo with a new one.) Word ...

Discover More

Best-Selling VBA Tutorial for Beginners Take your Excel knowledge to the next level. With a little background in VBA programming, you can go well beyond basic spreadsheets and functions. Use macros to reduce errors, save time, and integrate with other Microsoft applications. Fully updated for the latest version of Office 365. Check out Microsoft 365 Excel VBA Programming For Dummies today!

More ExcelTips (ribbon)

Deleting Zero Values from a Data Table

Want to get rid of all the zero values in a range of cells? This tip provides a couple of different ways you can ...

Discover More

Stepping Through a Non-Contiguous Range of Cells

Using macros to step through each cell in a selection is a common occurrence. What if that selected range is made up of ...

Discover More

Macros Run Fine Individually, but Not Collectively

Developing macros can be rewarding, but it can also be challenging. Getting individual macros to run properly is hard ...

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