VB and VBA Users Source Code: Display the available icons (FaceIds) for office commandbars
[
Home
|
Contents
|
Search
|
Reply
| Previous | Next ]
VB/VBA Source Code
Display the available icons (FaceIds) for office commandbars
By:
Andrew Baker
Email (spam proof):
Email the originator of this post
Date:
Thursday, June 27, 2002
Hits:
1348
Category:
Office
Article:
The following code will create several toolbars containing all the icons available for use in office toolbars. 'Creates toolbars with 300 faces icons on each (code written in Excel) Sub ShowAllToolbarIcons() Const clMaxFaceId As Long = 3900, clButtonsPerBar As Long = 300, clMaxToolbar As Long = 13 Dim lThisBar As Long, lFirstId As Long, lLastId As Long Dim lThisId As Long, oThisCtrl As CommandBarButton Dim oCmdBar As CommandBar, oClipIcon As StdPicture On Error GoTo ErrMaxID For lThisBar = 0 To clMaxToolbar 'Put 300 buttons on each bar lFirstId = lThisBar * clButtonsPerBar lLastId = lFirstId + clButtonsPerBar - 1 Set oCmdBar = CommandBars.Add For lThisId = lFirstId To lLastId Set oThisCtrl = oCmdBar.Controls.Add oThisCtrl.FaceId = lThisId oThisCtrl.TooltipText = "FaceId = " & lThisId Next On Error GoTo ErrBarExists oCmdBar.Name = "Buttons with FaceIds " & CStr(lFirstId) & " to " & CStr(lLastId) oCmdBar.Width = 591 oCmdBar.Visible = True Next Exit Sub 'Delete the button that caused the error and set toolbar name ErrMaxID: oThisCtrl.Delete oCmdBar.Name = ("Faces " & CStr(lFirstId) & " to " & CStr(lThisId - 1)) oCmdBar.Width = 591 oCmdBar.Visible = True ErrBarExists: 'Delete the existing command bar Application.CommandBars("Buttons with FaceIds " & CStr(lFirstId) & " to " & CStr(lLastId)).Delete Resume End Sub 'Remove the custom toolbars containing the icons Sub DeleteToolbars() Dim oCmdBar As CommandBar For Each oCmdBar In CommandBars If InStr(1, oCmdBar.Name, "Buttons with FaceIds") > 0 Then oCmdBar.Delete End If Next End Sub
Terms and Conditions
Support this site
Download a trial version of the Excel Workbook Rebuilder