
Tips.Net > WordTips Home > Macros > Intelligible Names for Macros
Summary: The names you use for macros can affect what you see when you add those macros to a toolbar. This tip explains how you can change macro names on toolbars, as well as change the ToolTip that appears for a macro. (This tip works with Microsoft Word 97, Word 2000, Word 2002, and Word 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:
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".
Tip #1494 applies to Microsoft Word versions: 97 2000 2002 2003
Save Time! You can have this tip (and several hundred just like it) in the WordTips annual archives. Imagine having over 400 tips available at your fingertips, in each annual volume.
Discover how to use Word's mail merge tool to create your own custom documents in just minutes. Great e-book answers all your questions. (more information...)
Ask a Word Question
Make a Comment
Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Pet Tips
Word2007 Tips
WordTips