I have some code that loads and unloads a command under the "DATA" menu bar.
Is it possible to add an item to the menu bar and put the commands under the new menu item?
For example:
Add "XYZ Consulting" as a menu bar item so it would like as follows:
File, Edit, Insert, Format, Tools, Data, Window, XYZ Consulting, Help.
Sub CreateMenu()
Dim Btn As CommandBarButton
Call DeleteMenu
Set Btn = Application.CommandBars("Worksheet Menu Bar").Controls("Data").Controls.Add
With Btn
.Move Before:=1
.Caption = "Trade &Analysis"
.OnAction = "TradeAnalysis"
End With
End Sub
Sub DeleteMenu()
On Error Resume Next
Application.CommandBars("Worksheet Menu Bar").Controls("Data").Controls("Trade Analysis").Delete
On Error GoTo 0
End Sub
Bookmarks