Change the availability for the shortcut menus using VBA in Microsoft Excel

The macro below shows how you can toggle the availability state for the shortcut menus.

Sub ToggleCommandBars()
Dim cbEnabled As Boolean
    cbEnabled = Not CommandBars(25).Enabled
    CommandBars(25).Enabled = cbEnabled ' shortcutmenu for cells
    CommandBars(26).Enabled = cbEnabled ' shortcutmenu for columns
    CommandBars(27).Enabled = cbEnabled ' shortcutmenu for rows
    CommandBars("Toolbar List").Enabled = cbEnabled ' shortcutmenu for toolbars
End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *

Terms and Conditions of use

The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.

Visit Us On TwitterVisit Us On FacebookVisit Us On Google PlusVisit Us On Youtube