View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
dim dim is offline
external usenet poster
 
Posts: 123
Default MAJOR PROBLEM! --- Menu Bars don't unhide?

Thanks Jim and John,

John I tried that code, but I'm getting told that -
"Compile Error: Procedure declaration does not match event or procedure
having the same name"

Any ideas?

Here's the code in ThisWorkbook:

Private Sub Workbook_BeforeClose()
HideBars (xlOff)
End Sub

Private Sub Workbook_Open()
HideBars (xlOn)
End Sub

And in Module1:

Sub HideBars(state)

Static myoldbars As New Collection
Dim mybar

If state = xlOn Then
For Each mybar In Application.CommandBars
If mybar.Type < 1 And mybar.Visible Then
myoldbars.Add mybar
mybar.Visible = False
End If
Next mybar

Else
For Each mybar In myoldbars
mybar.Visible = True
Next

End If
End Sub