Here's how to add a new menu item to EXCEL using VBA. The code below will create a new menu item labelled 'TEST' to the right of the current right-most item (normally the Help menu)
First of all delete the menu item if it already exists so we don't keep adding the same menu item on time after time.
For Each con In Application.CommandBars(1).Controls
If con.Caption = "TEST" Then
con.Delete
End If
Next
'
'Now add the new menu item:
With Application.CommandBars(1).Controls.Add(msoControlPopup)
.Caption = "TEST"
.OnAction = 'msgbox("You pressed the TEST menu item")"
End With
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.