Enable to hide Worksheet Menu Bar

C

cpmame

I have the following code in the ThisWorkbook (excel 2007), it works exactly
the way I want at the initial launch of the program. But once I minimize the
program and turn it back on the toolbar reappear. Is this a bug or something
wrong with my code? Please help.


Private Sub Workbook_Activate()
Call RemoveToolbars
End Sub

Private Sub Workbook_Deactivate()
Call RestoreToolbars
End Sub

Private Sub RemoveToolbars()
On Error Resume Next
With Application
.DisplayFullScreen = True
.CommandBars("Full Screen").Visible = False
.CommandBars("Worksheet Menu Bar").Enabled = False
End With
On Error GoTo 0
End Sub

Private Sub RestoreToolbars()
On Error Resume Next
With Application
.DisplayFullScreen = False
.CommandBars("Worksheet Menu Bar").Enabled = True
End With
On Error GoTo 0
End Sub
 

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