Hi
First step: Goto Project>References and add the "Microsoft Office Object Libary x.x" and the "Microsoft Excel Library x.x", where x.x represents your current Microsoft Office version.
(mxlApp represents your Excel Application here, create your own variable)
Set customBar = mxlApp.CommandBars("Worksheet Menu Bar")
Set newmenu = customBar.Controls.Add(Type:=Office.msoControlPopu p, Temporary:=True)
newmenu.Caption = "&TEST"
'creates a submenu (this is like File, Edit, Tools, Windows)
Set ctrl1 = newmenu.Controls.Add(Office.msoControlButton)
ctrl1.Caption = "&Sub1"
ctrl1.OnAction = "module_to_run_when_clicked"
'ctrl1 is a control which can be seen when clicking on, for example File, ....). When clicked, the subroutine which is set at .Onaction will be called
|