Hiding Menu Bar

D

David W

Is there a way to hide the menu bar, I know that you can right click on the
toolbar and go to the bottom and uncheck menubar, but when you click on OK
it comes right back.
I don't wont others to have the option to go and use it, I have got codes
for all of the events that the sheets need.
And if you do get it to go away how do you get it back
 
O

Orlando Magalhães Filho

Hi David W,

Always it must there be one visible menu bar, then you have to create an
empty menu bar. Try this:
1 - Open your workbook
2 - Press Alt+F11 to open VBE window
3 - Insert a standard module and
4 - Put the code below on it:

Dim MyMenuBar As CommandBar

Sub CreateMyMenuBar()
Set MyMenuBar = CommandBars.Add(Name:="MyMenu", Position:=msoBarTop,
MenuBar:=True, Temporary:=True)
MyMenuBar.Visible = True
End Sub

Sub DeleteMyMenuBar()
On Error Resume Next
MyMenuBar.Delete
Set MyMenuBar = Nothing
End Sub

5 - Double ThisWorkbook object and insert these event codes:

Private Sub Workbook_Activate()
CreateMyMenuBar
End Sub

Private Sub Workbook_Deactivate()
DeleteMyMenuBar
End Sub


HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top