I would like to create costum menu button using VBA in my excel 2010 file using predefined excel button that use face id. In my case i would like to use \"lock\" and \"refresh\
Modified previous answer to create numerous toolbars with sets of 10 icons. Can change code (comment/un-comment) number of toolbars (performance may be slow on slower machines)
The last icon number for Office 2013 that I could find was 25424 for OneDrive
Sub FaceIdsOutput()
' ==================================================
' FaceIdsOutput Macro
' ==================================================
' =========================
Dim sym_bar As CommandBar
Dim cmd_bar As CommandBar
' =========================
Dim i_bar As Integer
Dim n_bar_ammt As Integer
Dim i_bar_start As Integer
Dim i_bar_final As Integer
' =========================
Dim icon_ctrl As CommandBarControl
' =========================
Dim i_icon As Integer
Dim n_icon_step As Integer
Dim i_icon_start As Integer
Dim i_icon_final As Integer
' =========================
n_icon_step = 10
' =========================
i_bar_start = 1
n_bar_ammt = 500
' i_bar_start = 501
' n_bar_ammt = 1000
' i_bar_start = 1001
' n_bar_ammt = 1500
' i_bar_start = 1501
' n_bar_ammt = 2000
' i_bar_start = 2001
' n_bar_ammt = 2543
i_bar_final = i_bar_start + n_bar_ammt - 1
' =========================
' delete toolbars
' =========================
For Each cmd_bar In Application.CommandBars
If InStr(cmd_bar.Name,"Symbol") <> 0 Then
cmd_bar.Delete
End If
Next
' =========================
' create toolbars
' =========================
For i_bar = i_bar_start To i_bar_final
On Error Resume Next
Set sym_bar = Application.CommandBars.Add _
("Symbol" & i_bar, msoBarFloating, Temporary:=True)
' =========================
' create buttons
' =========================
i_icon_start = (i_bar-1) * n_icon_step + 1
i_icon_final = i_icon_start + n_icon_step - 1
For i_icon = i_icon_start To i_icon_final
Set icon_ctrl = sym_bar.Controls.Add(msoControlButton)
icon_ctrl.FaceId = i_icon
icon_ctrl.TooltipText = i_icon
Debug.Print ("Symbol = " & i_icon)
Next i_icon
sym_bar.Visible = True
Next i_bar
End Sub
Sub DeleteFaceIdsToolbar()
' ==================================================
' DeleteFaceIdsToolbar Macro
' ==================================================
Dim cmd_bar As CommandBar
For Each cmd_bar In Application.CommandBars
If InStr(cmd_bar.Name,"Symbol") <> 0 Then
cmd_bar.Delete
End If
Next
End Sub