Monday, 15 December 2008

Excel FaceID icons

This code shows toolbar with FaceID icons from 1 to 500. Updated the FOR loop to show the rest. There are few thousands of them.
Sub CreateFaceIDMenu()
    Dim MyBar As CommandBar
    Dim MyPopup As CommandBarPopup
    Dim MyButton As CommandBarButton
    Dim i

    DeleteFaceIDMenu

    Set MyBar = CommandBars.Add(Name:="FaceID Icons", _
        Position:=msoBarFloating, temporary:=True)

    With MyBar
        For i = 1 To 500
            Set MyButton = .Controls.Add(Type:=msoControlButton)
            With MyButton
                .Style = msoButtonIcon
                .FaceId = i
                .Caption = i
                .Visible = True
            End With
        Next

        .Width = Application.Width
        .Top = 4 / 3 * (Application.Top + Application.Height) - .Height - 50
        .Left = 4 / 3 * Application.Left + (4 / 3 * Application.Width - .Width) / 2 '850
        .Visible = True
End With
    
End Sub

Sub DeleteFaceIDMenu()
    On Error Resume Next
    CommandBars("FaceID Icons").Delete
    On Error GoTo 0
End Sub

No comments:

Post a Comment