Hack 10 Browse All Button ImagesWhen 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 Tools Figure 2-23. The selection of available button images seems quite limitedIn 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 that lets you browse all the Office faces, 100 at a time. The FaceID browser, shown in Figure 2-24, 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. Figure 2-24. Browsing available button images with the FaceID browserOnce 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 2-24. Open the Customize
dialog (select Tools Figure 2-25. Copying the image from one button to anotherNext, 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 2-26. Select Default Style so that only the image appears on your button, as shown in Figure 2-27. Figure 2-26. Pasting a button image onto a toolbar controlFigure 2-27. The new Unlink Hyperlinks button on the Standard toolbar2.9.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 2-28. Figure 2-28. A new (nonfunctional) toolbarIn 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 Shyam Pillai |