Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable or Hide Excel Menu Bar 1

Status
Not open for further replies.

HSMMIT

Technical User
Dec 21, 2000
12
US
I need to prevent users from using Excel's Menu Bar, so they will be forced to use the form I created to close and save the workbook.
 
I don't think that you can turn off the built-in menu bar. A long while ago, I recall that you would have to delete the menu items and then rebuild them when you are finished.

You may want to catch the user trying to Save or Close the workbook using custom macros. In the ThisWorkbook module:
Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

End Sub
'This will trap the user saving the workbook

Private Sub Workbook_BeforeClose(Cancel As Boolean)

End Sub
'This will trap the user closing the workbook
DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
 
Hello:

The following formats should help you . . .

Main Menu Bar Disable:
Application.CommandBars("Worksheet Menu Bar").Enabled = False

Items in Menu Disable:
Application.CommandBars("Insert").Controls.Item(2).Enabled = False


Remember to give yourself a means of re-enabling the menu bars / items later. I will often put these types of commands in the Workbook_Activate macro so that they run as soon as a workbook is open. I will put the "True" counterparts in the Workbook_BeforeClose macro.

To find out Command Bar Names, try something like:

For Each cbar In CommandBars
MsgBox (cbar.Name)
Next cbar

Hope that helps,

Marc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top