Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, and 2013. If you are using an earlier version (Word 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Word, click here: Attaching Macros to Documents.

Attaching Macros to Documents

Written by Allen Wyatt (last updated May 11, 2023)
This tip applies to Word 2007, 2010, and 2013


3

If you teach other people how to use Word, it is not unusual to prepare sample documents that your students can use while learning. If you need to teach them how to work with macros, you may even attach some sample macros to the documents you prepare for them. This is easy enough to do, but making it so your students can utilize the macros in the documents may not be so easy.

When the student opens your sample document (with sample macros attached), he or she may see a message indicating that the macros have been disabled. This behavior is normal for Word, and there is no way to disable it from within the macro or the document itself. The behavior is controlled by the security settings on the student's machine. Your student can check these settings using the Trust Center. You can display the Trust Center in either of two ways:

  • Make sure the Developer tab of the ribbon is selected and then click Macro Security in the Code group.
  • Display the Word Options dialog box. (In Word 2007 click the Office button and then click Word Options. In Word 2010 and Word 2013 display the File tab of the ribbon and then click Options.) Click Trust Center | Trust Center Settings | Macro Settings.

The Trust Center also has four settings for macro security:

  • Disable all macros without notification
  • Disable all macros with notification
  • Disable all macros except digitally signed macros
  • Enable all macros

You want to have the students choose the "Disable all macros with notification" option. (You don't want to have them choose "Enable all macros" for the security reasons already discussed.) If they make this choice, then even though the macros are disabled, they can still choose to run them by clicking a rather obvious button that will appear above the document—once it is loaded—and just below the ribbon.

Another possible solution, available for all versions of Word, is to place your sample macros in a template that is accessible to all the students through a network folder. Once in the template, then your students can create a document based on that template, and the macros should be available.

Perhaps the best solution, however, is to find a way to digitally sign your macros so that they are "trusted." If Word believes that macros are from a trusted source, it will load them automatically, even if the student has their security setting on High. Information on how to do this is quite involved. A good place to start looking for information is in the Word online Help system. Do a search for "Security Levels in Word."

Note:

If you would like to know how to use the macros described on this page (or on any other page on the WordTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (5909) applies to Microsoft Word 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Word here: Attaching Macros to Documents.

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 Cells Filled with a Particular Color

Do you need to find cells that are formatted with a particular color? How you accomplish this task depends on your ...

Discover More

Adjusting Your View of 3-D Graphs

Do you use Excel's charting capabilities to display three-dimensional views of your data? The program provides a way that ...

Discover More

Viewing Your Entire Document Width

The Zoom tool is very useful to help you see all of your document information. Here's how to make sure you can see all ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More WordTips (ribbon)

Reducing the Size of Spaces in a Selection

If you want to decrease the size of spaces in some selected text, the best approach is to use a macro. This tip includes ...

Discover More

Aligning a Paragraph in a Macro

If you are applying formatting from within a macro, you may want to change the alignment of various paragraphs. Here's ...

Discover More

Calculated Dates

Word makes it easy to insert today's date in a document, but not as easy to insert a date X number of days in the future. ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, 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 + 3?

2015-01-30 16:55:26

Peggy

I have created a restricted word form and attached a macro to it. However, some of the receivers can't access the macro even though it is attached to the document


2013-06-28 12:47:23

awyatt

Good catch, Derek. I'm sorry I didn't notice that earlier.

Macros are "attached" to things (documents, templates, etc.) when you direct Word to store the macro with that thing. For instance, here's a tip on writing a macro from scratch:

http://wordribbon.tips.net/T006821

Note step 3 in that tip; it says that you need to specify where you want the macro stored. When you choose to store the macro in a template, it is "attached" to that template. When you choose to store the macro in a specific document, it is "attached" to that specific document.

Hopefully that helps.

-Allen


2013-06-28 12:12:24

Derek Brown

I was expecting to be told how to attach a macro to a document, but all you say is that it's "easy enough".

You really meant "Enabling Attached Macros".

So how do you attach macros?


This Site

Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.

Videos
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, 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.