I have made a simple macro that adds a few macros to the context menu using the following template:
It is very simple and works well, but unfortunately it doesn't seem possible to add icons (FaceIDs or custom) to either the "main" menu item or the sub-menus. So, my first question would be: Is this statement true? Is there no way to add icons using this method?
If it isn't possible, it seems like the only way to go forward would be to make use of CommandBar, since it is compatible with having icons. The thing is, I would like to be able to share this to my co-workers as an add-in, but every tutorial I find on the internet it seems like each individual would have to copy the code to their personal workbook, which is not optimal in my opinion. My second question would therefore be if any of you know if the CommandBar method is compatible with being used as an add-in?
There is a good post on StackOverflow about this (Add an icon to (custom right_click menu) , Application.ShortcutMenus), but I'm unsure how exactly this code is supposed to be run and how it would work with sharing with my colleagues. Are these methods also compatible with being used as an add-in? I'm specifically wondering about the "custom icons" one.
The best thing for me would of course be if there is a way to add icons (FaceIDs or custom, doesn't matter) to the current code I'm using. If this is impossible, hopefully someone can help me understand CommandBar a little better, and if it is compatible with .xlam add-ins. I appreciate all help
VBA Code:
Private Sub Workbook_Open()
Dim MyMenu As Object
Set MyMenu = Application.ShortcutMenus(xlWorksheetCell) _
.MenuItems.AddMenu("This is my Custom Menu", 1)
With MyMenu.MenuItems
.Add "MyMacro1", "MyMacro1", , 1, , ""
.Add "MyMacro2", "MyMacro2", , 2, , ""
End With
Set MyMenu = Nothing
End Sub
It is very simple and works well, but unfortunately it doesn't seem possible to add icons (FaceIDs or custom) to either the "main" menu item or the sub-menus. So, my first question would be: Is this statement true? Is there no way to add icons using this method?
If it isn't possible, it seems like the only way to go forward would be to make use of CommandBar, since it is compatible with having icons. The thing is, I would like to be able to share this to my co-workers as an add-in, but every tutorial I find on the internet it seems like each individual would have to copy the code to their personal workbook, which is not optimal in my opinion. My second question would therefore be if any of you know if the CommandBar method is compatible with being used as an add-in?
There is a good post on StackOverflow about this (Add an icon to (custom right_click menu) , Application.ShortcutMenus), but I'm unsure how exactly this code is supposed to be run and how it would work with sharing with my colleagues. Are these methods also compatible with being used as an add-in? I'm specifically wondering about the "custom icons" one.
The best thing for me would of course be if there is a way to add icons (FaceIDs or custom, doesn't matter) to the current code I'm using. If this is impossible, hopefully someone can help me understand CommandBar a little better, and if it is compatible with .xlam add-ins. I appreciate all help