March 24, 2011, 7:20 p.m.
posted by francis
Browse All Button Images
When you start adding buttons or menus to a document or template, it would be nice to have more than a few button images to choose from. This hack shows you how to browse all the button images available on your system.
Customized toolbars and menus can be easier to work with when they're labeled with meaningful images. You can modify most toolbar buttons (both custom and built-in) when you open the Customize dialog (select ToolsCustomize). But when you right-click a button and choose Change Button Image, you're presented with a pretty limited selection, as shown in Figure.
The selection of available button images seems quite limited
In addition to this modest assortment, Microsoft Office includes more than 4,000 button images, or faces, that you can use or adapt as needed. Unfortunately, these poorly documented buttons can be difficult to access without using VBA code (and even then, it helps if you know the face ID number of the image).
If you want access to all the options, you can download a freeware add-in from http://www.mvps.org/skp/fidcode.htm that lets you browse all the Office faces, 100 at a time. The FaceID browser, shown in Figure, displays as a separate toolbar. When you hover your mouse over one of the buttons, the program displays its face ID number as a ToolTip.
Browsing available button images with the FaceID browser
Once you find an image you like, you can transfer it from the FaceID browser to a button on your toolbar. For example, let's say you want to put a button for the macro to unlink every hyperlink in a document [Hack #28] right next to the Hyperlink button on the Standard toolbar.
First, put a button for the macro on your toolbar [Hack #1]. Next, select an appropriate image from the FaceID browser, such as the one selected in Figure. Open the Customize dialog (select ToolsCustomize), right-click the button with the image you want to copy, and choose Copy Button Image, as shown in Figure.
Copying the image from one button to another
Next, with the Customize dialog still open, right-click the macro button you placed on the Standard toolbar and choose Paste Button Image, as shown in Figure. Select Default Style so that only the image appears on your button, as shown in Figure.
Pasting a button image onto a toolbar control
The new Unlink Hyperlinks button on the Standard toolbar
1 Hacking the Hack
When you create a toolbar or menu item from VBA code, you can specify which image to include by referencing its face ID. The face ID numbers have little organization, but they do tend to group together some related items. For example, the following macro creates an attractive (but nonfunctional) toolbar using the standard four card suits, as shown in Figure.
A new (nonfunctional) toolbar
In addition to setting the image, you can also specify what text will appear when the mouse hovers over the button, using the TooltipText property:
Sub MakeNewToolbar( ) Dim cbar As CommandBar Dim cbarctrl As CommandBarControl Set cbar = CommandBars.Add(Name:="Pick a Card", Position:=msoBarFloating) Set cbarctrl = cbar.Controls.Add(Type:=msoControlButton) cbarctrl.FaceId = 481 cbarctrl.TooltipText = "Hearts" Set cbarctrl = cbar.Controls.Add(Type:=msoControlButton) cbarctrl.FaceId = 482 cbarctrl.TooltipText = "Diamonds" Set cbarctrl = cbar.Controls.Add(Type:=msoControlButton) cbarctrl.FaceId = 483 cbarctrl.TooltipText = "Spades" Set cbarctrl = cbar.Controls.Add(Type:=msoControlButton) cbarctrl.FaceId = 484 cbarctrl.TooltipText = "Clubs" cbar.Visible = True End Sub