Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365. 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: Running Macros from Macros.

Running Macros from Macros

Written by Allen Wyatt (last updated May 11, 2019)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365


1

There may be times that you need to run a macro from within a macro using VBA. For instance, suppose you have a macro that creates a new document based on a template, and then runs a macro in that template. This is a relatively straightforward task and one way to handle it is to use the .Run method of the Application object. The command line to use this approach would be as follows:

Application.Run MacroName:="MyMacro"

Provided that there is no ambiguity on the macro name (there are no other macros in any open document or template with the same name), this approach will work just fine. A more elegant solution would be to specify the unambiguous name of the macro, as described in the next tip.

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 (11411) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365. You can find a version of this tip for the older menu interface of Word here: Running Macros from Macros.

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

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

Converting Imported Information to Numeric Values

If the information you import into Excel is treated as text by the program, you may want to convert it to numeric values. ...

Discover More

Moving the Insertion Point in a Macro

One of the common things done in macros is to somehow "process" documents, which often means moving the insertion point ...

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 WordTips (ribbon)

Clearing the Undo Stack in a Macro

When writing a macro, you may need a way to clear the undo stack. This can be done with a single command, as described in ...

Discover More

Selecting a Bookmark in a Macro

Bookmarks can be very handy in a document. Word provides a VBA command you can use to easily select any of those bookmarks.

Discover More

Clean Up Your Macro List

Macros are part of the document and template that are loaded into memory when you open a file. If you have "junk" macros ...

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 8 - 5?

2019-05-13 13:01:51

Hugh

Within a macro, can't you just use the name of the macro itself as a command. For instance, instead of typing

Application.Run MacroName:="MyMacro"

couldn't you just type

MyMacro


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.