so searched google for info on this (found how to make menu items but not how to make a menu Name). would like it to appear after the Help menu.
below is code to make the menu items:
Sub AddNewVBEControls()
Dim Ctrl As Office.CommandBarControl
'''''''''''''''''''''''''''''''''''''''''''''''''
' Delete any existing controls with our Tag.
'''''''''''''''''''''''''''''''''''''''''''''''''
Set Ctrl = Application.VBE.CommandBars.FindControl(Tag:=C_TAG)
Do Until Ctrl Is Nothing
Ctrl.Delete
Set Ctrl = Application.VBE.CommandBars.FindControl(Tag:=C_TAG)
Loop
'''''''''''''''''''''''''''''''''''''''''''''''''
' Delete any existing event handlers.
'''''''''''''''''''''''''''''''''''''''''''''''''
Do Until EventHandlers.Count = 0
EventHandlers.Remove 1
Loop
'''''''''''''''''''''''''''''''''''''''''''''''''
' add the first control to the Tools menu.
'''''''''''''''''''''''''''''''''''''''''''''''''
Set MenuEvent = New CVBECommandHandler
With Application.VBE.CommandBars("Menu Bar").Controls("Tools")
Set CmdBarItem = .Controls.Add
End With
With CmdBarItem
.Caption = "First Item"
.BeginGroup = True
.OnAction = "'" & ThisWorkbook.Name & "'!Procedure_One"
.Tag = C_TAG
End With
Set MenuEvent.EvtHandler = Application.VBE.Events.CommandBarEvents(CmdBarItem)
EventHandlers.Add MenuEvent
'''''''''''''''''''''''''''''''''''''''''''''''''
' add the second control to the Tools menu.
'''''''''''''''''''''''''''''''''''''''''''''''''
Set MenuEvent = New CVBECommandHandler
With Application.VBE.CommandBars("Menu Bar").Controls("Tools")
Set CmdBarItem = .Controls.Add
End With
With CmdBarItem
.Caption = "Second Item"
.BeginGroup = False
.OnAction = "'" & ThisWorkbook.Name & "'!Procedure_Two"
.Tag = C_TAG
End With
Set MenuEvent.EvtHandler = Application.VBE.Events.CommandBarEvents(CmdBarItem)
EventHandlers.Add MenuEvent
End Sub
checked out chip's site, microsoft and others
tried this in the immediate window (with no success)
application.CommandBars.Add "DansMenu"
application.VBE.CommandBars.Add "DansMenu"
application.vbe.commandbars("DansMenu").controls.add
can someone point me in the right direction so that i can create a menu in the VB editor?
Bookmarks