![]() |
Drop down menus
Can anyone tell me how to get a drop down menu (say called 'Feeds') on the
Standard toolbar between the Data and Window drop downs and from that menu items so that I can 'attach' them to macros Many thanks James |
Drop down menus
James,
Paste something like this in a code module: 'CreateMyMenu will create the menu 'DeleteMyMenu deletes the menu 'Test is a sub executed in the menu item Sub CreateMyMenu() Dim cmdBar As CommandBar Dim cmdBarMenu As CommandBarControl Dim cmdBarMenuItem As CommandBarControl Set cmdBar = Application.CommandBars("Worksheet Menu Bar") Set cmdBarMenu = cmdBar.Controls.Add(Type:=msoControlPopup, Befo=cmdBar.Controls("Window").Index) cmdBarMenu.Caption = "M&yMenu" cmdBarMenu.Tag = "MINE" Set cmdBarMenuItem = cmdBarMenu.Controls.Add With cmdBarMenuItem .Caption = "&Macro1" .OnAction = "Test" .Tag = "MINE" End With End Sub Sub DeleteMyMenu() Dim c As CommandBarControl On Error Resume Next For Each c In Application.CommandBars.FindControls(Tag:="MINE") c.Delete Next c End Sub Sub test() MsgBox "Hello, World" End Sub -- Hope that helps. Vergel Adriano " wrote: Can anyone tell me how to get a drop down menu (say called 'Feeds') on the Standard toolbar between the Data and Window drop downs and from that menu items so that I can 'attach' them to macros Many thanks James |
Drop down menus
Spot on Vergel
Thanks for that James "Vergel Adriano" wrote: James, Paste something like this in a code module: 'CreateMyMenu will create the menu 'DeleteMyMenu deletes the menu 'Test is a sub executed in the menu item Sub CreateMyMenu() Dim cmdBar As CommandBar Dim cmdBarMenu As CommandBarControl Dim cmdBarMenuItem As CommandBarControl Set cmdBar = Application.CommandBars("Worksheet Menu Bar") Set cmdBarMenu = cmdBar.Controls.Add(Type:=msoControlPopup, Befo=cmdBar.Controls("Window").Index) cmdBarMenu.Caption = "M&yMenu" cmdBarMenu.Tag = "MINE" Set cmdBarMenuItem = cmdBarMenu.Controls.Add With cmdBarMenuItem .Caption = "&Macro1" .OnAction = "Test" .Tag = "MINE" End With End Sub Sub DeleteMyMenu() Dim c As CommandBarControl On Error Resume Next For Each c In Application.CommandBars.FindControls(Tag:="MINE") c.Delete Next c End Sub Sub test() MsgBox "Hello, World" End Sub -- Hope that helps. Vergel Adriano " wrote: Can anyone tell me how to get a drop down menu (say called 'Feeds') on the Standard toolbar between the Data and Window drop downs and from that menu items so that I can 'attach' them to macros Many thanks James |
All times are GMT +1. The time now is 09:47 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com