I am trying to add my own popup menu into
CommandBars("Cell").
The name of menu is successfully created, but I can't add buttons into that menu. AutoComplete shows no
Add method. How to solve this problem?
Code:
Sub AddShortCut()
Dim cb As CommandBar
Dim ct As CommandBarControl
Dim index As Integer
Set cb = CommandBars("Cell")
index = cb.Controls("Cut").index
Set ct = cb.Controls.Add(Type:=msoControlPopup, Before:=index)
ct.Caption = "Bonus"
Call ClearRefs(cb, ct)
End Sub
Private Sub ClearRefs(ParamArray refs() As Variant)
Dim ref As Variant
For Each ref In refs
Set ref = Nothing
Next
End Sub