Identifying CommandBar Images
Category: CommandBars & Menus | [Item URL]
Excel 97 through Excel 2003 uses many images in its built in menus and toolbars. You can use these built-in images in your custom menus and toolbars by setting the FaceId property to a particular integer. The problem, however, is determining which integer corresponds to each image.
The subroutine below creates a custom toolbar with the first 250 FaceID images (shown below). You can see even more images by changing the values for IDStart and IDStop. The last FaceID image appears to be number 3518 (there are also many blank images).
After creating the toolbar, move the mouse pointer over a button to find out the FaceID value for the image. Clicking the toolbar buttons will have no effect since the subroutine doesn't assign any macros to the OnAction properties.
The ShowFaceIds Subroutine
Sub ShowFaceIDs()
Dim NewToolbar As CommandBar
Dim NewButton As CommandBarButton
Dim i As Integer, IDStart As Integer, IDStop As Integer
' Delete existing FaceIds toolbar if it exists
On Error Resume Next
Application.CommandBars("FaceIds").Delete
On Error GoTo 0
' Add an empty toolbar
Set NewToolbar = Application.CommandBars.Add _
(Name:="FaceIds", temporary:=True)
NewToolbar.Visible = True
' Change the following values to see different FaceIDs
IDStart = 1
IDStop = 250
For i = IDStart To IDStop
Set NewButton = NewToolbar.Controls.Add _
(Type:=msoControlButton, Id:=2950)
NewButton.FaceId = i
NewButton.Caption = "FaceID = " & i
Next i
NewToolbar.Width = 600
End Sub
Excel Tips
Excel has a long history, and it continues to evolve and change. Consequently, the tips provided here do not necessarily apply to all versions of Excel.
In particular, the user interface of the most recent version, Excel 2007, is vastly different from its predecessors. Therefore, the menu commands listed in older tips, will not correspond to the Excel 2007 user interface.
All Tips
Browse Tips by Category
Search for Tips
Tip Books
Needs tips? Here are two books, with nothing but tips:
Contains more than 200 useful tips and tricks for Excel 2007 | Other Excel 2007 books | Amazon link: John Walkenbach's Favorite Excel 2007 Tips & Tricks
Contains more than 200 useful tips and tricks for Excel | Other Excel 2003 books | Amazon link: John Walkenbach's Favorite Excel Tips & Tricks
