Hi,
I want to be able to put my own custom icons in Excel. The code below works nicely, but instead of FaceID, I want to replace it with my own icon or image.
Can someone help me with this problem.
Thank you.
I want to be able to put my own custom icons in Excel. The code below works nicely, but instead of FaceID, I want to replace it with my own icon or image.
Can someone help me with this problem.
Code:
Public The_Menu As CommandBar
Function CreateSubMenu() As CommandBar
Const pop_up_menu_name = "Pop-up Menu"
Dim the_command_bar As CommandBar
Dim the_command_bar_control As CommandBarControl
'Deletes any CommandBars that may be present
For Each menu_item In CommandBars
If menu_item.Name = pop_up_menu_name Then
CommandBars(pop_up_menu_name).Delete
End If
Next
''Add our popup menu to the CommandBars collection
Set the_command_bar = CommandBars.Add(Name:=pop_up_menu_name, Position:=msoBarPopup, MenuBar:=False, Temporary:=False)
'*****Menu Options*****
Set the_command_bar_control = the_command_bar.Controls.Add
the_command_bar_control.Caption = "Add"
the_command_bar_control.OnAction = "Add"
the_command_bar_control.FaceId = 3
Set the_command_bar_control = the_command_bar.Controls.Add
the_command_bar_control.Caption = "Edit"
the_command_bar_control.OnAction = "Add"
Set the_command_bar_control = the_command_bar.Controls.Add
the_command_bar_control.Caption = "Add"
the_command_bar_control.OnAction = "Add"
Set the_command_bar_control = the_command_bar.Controls.Add
the_command_bar_control.Caption = "Add"
the_command_bar_control.OnAction = "Add"
Set CreateSubMenu = the_command_bar
End Function
Code:
Private Sub Label61_Click()
Set The_Menu = CreateSubMenu
The_Menu.ShowPopup
End Sub
Thank you.