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

Exporting a Graphics Group

Need to export a graphics group from a chart so that you can use the group in a different program? It's not as easy as ...

Discover More

Continuing Macro Lines

Sometimes a macro command line can get very, very long. This can make it hard to understand when you look at it a month ...

Discover More

Finding Cells that Use Conditional Formatting

Conditional Formatting is a great boon to effectively displaying the information in your worksheets. If you want to ...

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 (menu)

Swapping Two Strings

Part of developing macros is learning how to use and manipulate variables. This tip examines a technique you can use to ...

Discover More

Assigning a Macro to a Button in Your Text

One way you can access macros is through the use of a button, added directly into the text of your document. This is done ...

Discover More

Changing Roman Numerals to Arabic

In some documents Roman numerals might be used quite a bit. If you ever want to change the Roman numerals to their Arabic ...

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 four minus 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 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.