View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
cpmame cpmame is offline
external usenet poster
 
Posts: 8
Default Enable to hide Worksheet Menu Bar

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