Face ID Toolbar Generator

This VBA code will create three toolbars with the first 1500 faceIDs.

What are FaceIDs?

They are numbers representing small icons which are used in toolbars and menus. For example, the little "diskette" 'Save' button is FaceID #3. I don't know how high the FaceID list goes, but you can certainly extend this code and see how far you can get!

Sub FaceIDList()
'
' creates a cool toolbar list of faceIDs with their corresponding numbers
'
'
Dim cmdbar As CommandBar
Dim cmdbtn As CommandBarButton
Dim objButton As CommandBarControl
Dim i As Long

Application.ScreenUpdating = False
    ' delete them in case they are still lingering
   On Error Resume Next
   Application.CommandBars("Icons 0 through 500").Delete
   Application.CommandBars("Icons 501 through 1000").Delete
   Application.CommandBars("Icons 1001 through 1500").Delete
   On Error GoTo 0

Set cmdbar = Application.CommandBars.Add(Name:="Icons 0 through 500")
cmdbar.Visible = True

    For i = 0 To 500
        Application.StatusBar = "Creating Face ID Button " & i & " out of 500"
        Set objButton = cmdbar.Controls.Add
        With objButton
            .Style = 3
            .Caption = i
            .FaceId = i
            .Visible = True
            .TooltipText = "Face ID: " & i
        End With
    Next i

Application.StatusBar = False
Set cmdbar = Application.CommandBars.Add(Name:="Icons 501 through 1000")
cmdbar.Visible = True

    For i = 501 To 1000
        Application.StatusBar = "Creating Face ID Button " & i & " out of 1000"
        Set objButton = cmdbar.Controls.Add
        With objButton
            .Style = 3
            .Caption = i
            .FaceId = i
            .Visible = True
            .TooltipText = "Face ID: " & i
        End With
    Next i

Application.StatusBar = False
Set cmdbar = Application.CommandBars.Add(Name:="Icons 1001 through 1500")
cmdbar.Visible = True

    For i = 1001 To 1500
        Application.StatusBar = "Creating Face ID Button " & i & " out of 1500"
        Set objButton = cmdbar.Controls.Add
        With objButton
            .Style = 3
            .Caption = i
            .FaceId = i
            .Visible = True
            .TooltipText = "Face ID: " & i
        End With
    Next i

Application.StatusBar = False
Application.ScreenUpdating = True
Set objButton = Nothing
Set cmdbar = Nothing
End Sub

Site last updated: May 17, 2012

Random Data Generator