CustomExcelMenu - FaceIDs

How to create custom Excel menu, this one shows the IDs and icons of 20 icons, you may change from what ID to start showing.
Most of FaceIDs can be found in http://Programmers.codes/?DevID=J9GIMEFSG9

Sub CustomExcelMenu(Optional StartFromFaceID = 311)
 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
 ' Change the following values to see different FaceIDs
 IDStart = StartFromFaceID ' 311
 IDStop = StartFromFaceID + 20 ' 330 '250
 With Application.CommandBars.Add(Name:="FaceIds", Position:=msoBarPopup, MenuBar:=False, temporary:=True)
  For i = IDStart To IDStop
   With .Controls.Add(Type:=msoControlButton)
    If i / 10 = Int(i / 10) Then .BeginGroup = True
    .Caption = "FaceID = " & i
    .FaceId = i '346
    ' .OnAction = "'" & ThisWorkbook.Name & "'!" & "ValidateRow"
   End With
  Next i
 End With
 Application.CommandBars("FaceIds").Width = 4500
 Application.CommandBars("FaceIds").ShowPopup
End Sub


' From YaShFin application
' Dim Added As CommandBar, AddCon As CommandBarControl
' Set Added = Application.CommandBars.Add("YaShFin ToolBar")
' Added.Visible = false
' AddCon.Caption = "Y&aShFin"
' menuname = AddCon.CommandBar.Name
' DoEvents
' Set AddCon = Added.Controls.Add(msoControlPopup)
' Set AddCon = Application.CommandBars(menuname).Controls.Add(msoControlButton)
' AddCon.Caption = "YaShFin &main file"
' AddCon.OnAction = "gotomain"
' addcon.begingroup=true
' Set AddCon = Application.CommandBars(menuname).Controls.Add(msoControlPopup)
' AddCon.Caption = "Current &Report"
' AddCon.BeginGroup = True
' menu2 = AddCon.CommandBar.Name
' Set AddCon = Application.CommandBars(menu2).Controls.Add(msoControlButton)
' AddCon.Caption = "&Year Book"
' AddCon.OnAction = "currentyearbook"
' Added.Visible = True

Optional StartFromFaceID

Views 399 Downloads 149

'Menu', 'Excel', 'Custom', 'FaceIDs', 'Icon', 'Icons', 'Menu'

ANmarAmdeen
324
Attachments
UI VBA-Excel
Revisions

v1.0