Intelligible Names for Macros

Written by Allen Wyatt (last updated February 18, 2020)
This tip applies to Word 97, 2000, 2002, and 2003


When you assign macros to a toolbar, you have the option to change the Name assigned to the macro on the toolbar. If you later want to change this name, you can display the Customize dialog box (right-click on the toolbar and choose Customize from the resulting Context menu) and then right-click on the toolbar button.

There is only one problem with this approach: The Name setting for the toolbar button is nothing more than the name that appears as text within the toolbar, if you choose to have text or text and image displayed in the toolbar. (This may sound a bit confusing, especially to a Word novice. It all has to do with the settings that you choose when first adding the macro to your toolbar or when you display the Modify Selection menu for the toolbar button.) What if you want to change the actual ToolTip that appears when you hover the mouse pointer over the toolbar button?

Unfortunately, there is no easy way to change the ToolTip from any menu you can display in Word. Again, the Name field in the Modify Selection menu only controls what is shown as text within the toolbar button; it does not affect the ToolTip. So what are you to do? The only thing you can do is modify the ToolTip text via VBA and modify it in that way. The following short macro will do the trick:

Public Sub FixToolTip()
    Const sToolTip As String = "My ToolTip Text"
    Const sTBName As String = "Standard"
    Const iBtnIdx As Integer = 5

    CommandBars(sTBName).Controls(iBtnIdx).TooltipText = sToolTip
End Sub

This macro only has to be run once, because Word remembers the new ToolTip text once it is set. All you need to do is change the values assigned to the three constants at the beginning of the macro:

  • sToolTip. This is the text you want displayed as a ToolTip.
  • sTBName. This is the name of the toolbar on which the button resides. This is the same toolbar name that you see when you choose Toolbars from the View menu.
  • iBtnIdx. This is the numeric position of the button on the toolbar. If you are using Word 97, all you need to do is count the buttons from the left side of the toolbar, beginning with one. If you are using Word 2000 or later, all buttons may not be displayed on the toolbar. Simply undock the toolbar so they are all displayed in their regular order, and then do your count.

If you ran the macro exactly as it appears above, then the fifth button from the left on the Standard toolbar would have the ToolTip text of "My ToolTip Text".

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 (1494) applies to Microsoft Word 97, 2000, 2002, and 2003.

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

Editing Graphic Objects

Want to change the way that a graphic object appears in your worksheet? You need to edit it, then, using the techniques ...

Discover More

Centering Your Worksheet

Got just a small amount of worksheet data to print out? It might look better on the printed page if you center it. Excel ...

Discover More

Drawing Lines

Lines are one of the most common graphic elements to be added to documents. Here's how you can add the lines you want.

Discover More

The First and Last Word on Word! Bestselling For Dummies author Dan Gookin puts his usual fun and friendly candor back to work to show you how to navigate Word 2013. Spend more time working and less time trying to figure it all out! Check out Word 2013 For Dummies today!

More WordTips (menu)

Defining a Shortcut for a Macro

You can make running macros very easy if you assign a shortcut key to the macro. This tip demonstrates how easy it is to ...

Discover More

Toggling Font Assignments in a Macro

If you need to quickly switch a text selection from one typeface to another, one way you can do it is with a macro. This ...

Discover More

Counting the Instances of a Text String

Sometimes it is helpful to know how often a particular phrase appears within a document. If you need to know such a ...

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 two more than 7?

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 Word that uses the menu interface (Word 97, Word 2000, Word 2002, or Word 2003)? This site is for you! If you use a later version of Word, visit our WordTips site focusing on the ribbon 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.