Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, 2013, 2016, 2019, and 2021. 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: Printing a Macro List.

Printing a Macro List

Written by Allen Wyatt (last updated October 23, 2021)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, and 2021


4

Many Word users rely upon macros to perform all sorts of tasks in the program. Over the years it is possible to accumulate quite a few different macros. At some point you may want a way to print out a list of your macros for reference purposes. Unfortunately, Word doesn't provide a way you easily print out such a macro list.

If you just need a quick list, one way to do it is to use Word's built-in tools to list all the commands available to Word. Since Word considers macros to be "commands," the command list will also include your macros. But since you don't want all the other commands in Word (besides your macros), you will need to do a little editing. Follow these steps:

  1. Press Alt+F8. Word displays the Macros dialog box.
  2. Using the Macros In drop-down list, choose Word Commands. (See Figure 1.)
  3. Figure 1. The Macros dialog box.

  4. In the list of Word commands, select the ListCommands option.
  5. Click on Run. Word begins to run the macro and displays the List Commands dialog box.
  6. Click the All Word Commands radio button.
  7. Click OK.

Word then creates a new document that contains a table with all Word commands. Remember that your macros are buried within the table. To find them, search for "normal." (make sure you include the period, but not the quote marks). This finds any "commands" contained in the Normal document template. You can copy the names of these commands—they are your macros—to a different document. If you have macros in any other templates, search for those template names, as well.

Another approach is to follow these general steps:

  1. If your macros are not in the Normal template, open the template that contains your macros.
  2. Press Alt+F11. Word displays the Visual Basic Editor.
  3. Double click a module on the left side, in the Project Explorer, so that the code appears in a Code window on the right side.
  4. Click once in the Code window, so you can see the insertion point there.
  5. Press Ctrl+A. This selects all the code in the Code window.
  6. Press Ctrl+C. This copies the macro code to the Clipboard.
  7. Open a new Word document and paste all the macro code into the document.
  8. Press Ctrl+End to move to the end of the document.
  9. Press Ctrl+H. Word displays the Replace tab of the Find and Replace dialog box.
  10. Click the More button if it is available. (See Figure 2.)
  11. Figure 2. The Replace tab of the Find and Replace dialog box.

  12. Make sure the Use Wildcards check box is selected.
  13. Using the Search drop-down list, choose Up.
  14. In the Find What box, type the following: (Sub*\(\))(*)
  15. In the Replace box, type the following: \1^p
  16. Click Replace All.

What you instructed Word to do was to delete everything except the subroutine names (these are your macro names). What is not included in this process are any functions you may have created in your macros. Those functions are not publicly available macros, so for most people this isn't a big issue.

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 (13041) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, and 2021. You can find a version of this tip for the older menu interface of Word here: Printing a Macro List.

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

Deleting Blank Rows

Got some pesky blank rows in your data that you want to get rid of? This tip provides a wide variety of methods you can ...

Discover More

Resize Graphics Outside of Word

Need your graphics to be larger or smaller than they first appear when you insert them in a document? Your best bet may ...

Discover More

Displaying Blanks when Summing to Zero

If you use fields to sum the information in your table columns, you might want to display a blank when the sum is zero. ...

Discover More

Do More in Less Time! An easy-to-understand guide to the more advanced features available in the Microsoft 365 version of Word. Enhance the quality of your documents and boost productivity in any field with this in-depth resource. Complete your Word-related tasks more efficiently as you unlock lesser-known tools and learn to quickly access the features you need. Check out Microsoft 365 Word For Professionals For Dummies today!

More WordTips (ribbon)

Checking for a Text Selection Length

Need to know if the user selected some text before running your macro? Here’s how to make that check.

Discover More

Deleting a Macro

Macros are often created to accomplish a specific task, after which they are no longer needed. If you need to delete a ...

Discover More

Moving to the Start or End of the Real Document

The main body of your text is only one part of what makes up the entire document. Documents can consist of other ...

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 5 + 3?

2021-11-12 22:25:47

Tomek

The document created as described in the first part of the tip is very useful. Beware however, that for user macros the two other columns: Modifier and Key, are not showing the shortcut keys even if they are assigned to the macro. At least this is the result I got in my limited testing.

There was another tip that showed how to print key assignment list, which includes only user-assigned keys.
https://wordribbon.tips.net/T009256_Printing_a_Key_Assignment_List

Unluckily, I was not able to find something similar for Excel :-( On the other hand, an approach proposed by Ken Endacott should work. I think I saw an Excel tip recently with a similar macro.

@Kiwerry: this may be relevant to our recent discussion.


2021-11-08 04:48:32

Ken Endacott

Kiwerry,

If the macro is your document for example MyMacros.docm, open MyMacros.docm then open Normal.dotm. Minimise MyMacros.docm leaving Normal.dotm visible and run the macro.

Regarding Public and Private it is just a matter of adding
Or Left(s,6) = “Public” Or Left(s,7) = “Private”

There is a shortcoming to the macro as it stands. It only finds macros in modules, it doesn’t find macros in other parts of the project such as controls.


2021-11-07 13:43:35

Kiwerry

Thanks for a useful tool, Ken. I have a question and a comment:

How can I get a list of the procedures in my Normal template? I tried replacing fname with the full path of Normal.dotm ("c:\Users\[anon]\AppData\Roaming\Microsoft\Templates\Normal.dotm") but that generated a "Bad File Name" error. The name was correct: I navigated to the file and transferred the full path to the code using the clipboard.

If one has used the Public or Private qualifiers then the check for a sub or function will have to be more than just looking at the first three characters in a line (If Left(s, 3) = "Sub" ...)


2021-10-23 18:52:38

Ken Endacott

Here is a macro that will create a list of macros in the currently open document or template. For example if you want a list of macros in the Normal template then open the template and run the macro.
The list is copied into a new document.
Before running the macro make sure that "Microsoft Visual Basic for Applications Extensibility 5.3" is checked in Tools > References.


Sub CreateMacroList()
' Microsoft Visual Basic for Applications Extensibility 5.3
' must be set in Tools > References
Dim vbComp As VBIDE.VBComponent
Dim fName As String
Dim s As String
Dim j As Long
Dim k As Long
fName = ActiveDocument.Name
Documents.Add
For Each vbComp In Documents(fName).VBProject.VBComponents
If vbComp.Type = vbext_ct_StdModule Then
Selection.TypeText vbCrLf & vbComp.Name & vbCrLf
j = vbComp.CodeModule.CountOfLines
If j > 0 Then
For k = 1 To j
s = Trim(vbComp.CodeModule.Lines(k, 1))
If Left(s, 3) = "Sub" Or Left(s, 6) = "Function" Then _
Selection.TypeText s & vbCrLf
Next k
End If
End If
Next vbComp
ActiveDocument.Range.NoProofing = True
End Sub


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.