![excel 2016 menu bar excel 2016 menu bar](https://cdn.windowsreport.com/wp-content/uploads/2020/02/how-to-repair-excel-toolbar-missing.png)
Click this, you will see there are 3 dropdown items below this. The sample workbook adds a menu item called 'My Macros'.
#Excel 2016 menu bar code#
Paste the code into the right pane of the Module.Click on the Project(Workbook) name in the left pane.Press Alt+F11 from Excel to open the VB Editor.
![excel 2016 menu bar excel 2016 menu bar](https://www.officetooltips.com/images/tips/174_2016/2.png)
On Error Resume Next 'in case the menu item has already been deletedĪpplication.CommandBars("Worksheet Menu Bar").Controls("My Macros").Delete 'delete the menu item Private Sub Workbook_BeforeClose(Cancel As Boolean) FaceId = 1098 'assigns an icon to the dropdown OnAction = "RunMyMacro1" 'runs the specified macro Caption = "My Macro No 1" 'adds a description to the menu item Controls.Add(Type:=msoControlButton) 'adds a dropdown button to the menu item Caption = "&My Macros" 'names the menu item Set cmbControl = (Type:=msoControlPopup, temporary:=True) 'adds a menu item to the Menu Bar Set cmbBar = Application.CommandBars("Worksheet Menu Bar") There are two pieces of code involved - the first creates the menu items on opening and the second deletes them on closing the workbook. This can also be useful when creating an add-in and allows you to create client specific menu items - which increases the professional look of your work. By adding the code to your Personal.xls you can assign your favourite or most commonly used macros - ready to run when you need them. This allows you to run specific macros direct from the Menu Bar - something that is easy even for inexperienced users. These items can be added to a specific workbook, to an add-in or to your Personal.xls. It can be useful to add custom menu items to a variety of workbooks.
![excel 2016 menu bar excel 2016 menu bar](https://bettersolutions.com/excel/ribbon/mini-toolbar-cellsminitoolbar.png)
You can then assign specific macros to run from these items