Article ID: 206493
Article Last Modified on 9/12/2006
Sub Disable_Menu_Bar()
CommandBars("Standard").Enabled = False
End Sub
The following macro re-enables the Standard command bar so that it is displayed when a worksheet is active.
Sub Enable_Menu_Bar()
CommandBars("Standard").Enabled = True
End Sub
NOTE: Although the Worksheet menu bar is a command bar, you can not disable it in Microsoft Excel 98 Macintosh Edition. On the Macintosh, the menu bar must remain at the top of the screen.
Sub Delete_Help_Menu()
CommandBars("Worksheet Menu Bar").Controls("Window").Delete
End Sub
The following macro restores the Help menu to the Worksheet menu bar.
Sub Restore_Help_Menu()
set x = CommandBars("Worksheet Menu Bar")
x.Reset
End Sub
NOTE: This macro resets the entire Worksheet menu bar back to its default settings. When you run this macro, all customizations that you made to the Worksheet menu bar are lost.
Sub Delete_Menu_Item()
Set x = CommandBars("Worksheet Menu Bar").Controls("Help")
x.Controls("Contents and Index").Delete
End Sub
The following macro restores the Contents and Index menu command on the Help menu.
Sub Restore_Menu_Item()
Set x = CommandBars("Worksheet Menu Bar").Controls("Help")
x.Controls.Add Type:=msoControlButton, Id:=983, before:=2
End Sub
Sub Delete_Submenu()
Set x = CommandBars("Worksheet Menu Bar").Controls("Format")
x.Controls("Sheet").Delete
End Sub
The following macro restores the Sheet submenu on the
Format menu.
Sub Restore_Submenu()
Set x = CommandBars("Worksheet Menu Bar").Controls("Format")
x.Controls.Add Type:=msoControlPopup, ID:=30026, before:=4
End Sub
Sub Delete_Item_on_Submenu()
Set x = CommandBars("Tools").Controls("Protection")
x.Controls("Protect Sheet...").Delete
End Sub
The following macro restores the Protect Sheet menu command on the
Protection submenu (on the Tools menu).
Sub Restore_Item_on_Submenu()
Set x = CommandBars("Tools").Controls("Protection")
x.Controls.Add Type:=msoControlButton, Id:=893, before:=1
End Sub
Sub Delete_Menu_on_Toolbar()
CommandBars("Drawing").Controls("Draw").Delete
End Sub
The following macro restores the Draw menu on the Drawing toolbar.
Sub Restore_Menu_on_Toolbar()
Set x = CommandBars("Drawing")
x.Controls.Add Type:=msoControlPopup, Id:=30013, before:=1
End Sub
Sub Delete_Shortcut_menu_item()
CommandBars("Cell").Controls("Insert Comment").Delete
End Sub
The following macro restores the Insert Comment menu command on the
worksheet cell shortcut menu and restores the separator line that the
previous macro deleted.
Sub Restore_Shortcut_menu_item()
Set x = CommandBars("cell")
x.Controls.Add Type:=msoControlButton, Id:=2031, before:=8
Application.ShortcutMenus(xlWorksheetCell).MenuItems.Add _
Caption:="-", before:=9
End Sub
Additional query words: commandbar menubar XL98
Keywords: kbhowto kbprogramming kbdtacode KB206493