I have an app where I use forms for user input and store that input on sheets that the user never sees. I use the following code to hide all of the menus:
Public Sub EverythingOff()
Application.ScreenUpdating = False
Dim cb As CommandBar
For Each cb In CommandBars
Application.ScreenUpdating = False
Debug.Print cb.Name
Debug.Print cb.Visible
If cb.Type < 3 Then cb.Enabled = False
Next cb
With ActiveWindow
.DisplayHeadings = False
.DisplayWorkbookTabs = False
End With
With Application
.DisplayFormulaBar = False
.DisplayFullScreen = True
.DisplayScrollBars = False
.DisplayStatusBar = False
End With
Set cb = Nothing
End Sub
and this code in Workbook_BeforeClose:
Public Sub EverythingOn()
Dim cb As CommandBar
For Each cb In CommandBars
Debug.Print cb.Name
Debug.Print cb.Visible
If cb.Type < 3 Then cb.Enabled = True
If cb.Name = "IWD" Then
cb.Enabled = False
End If
Next cb
With ActiveWindow
.DisplayHeadings = True
.DisplayWorkbookTabs = True
End With
With Application
.DisplayFullScreen = False
.DisplayFormulaBar = True
.DisplayScrollBars = True
.DisplayStatusBar = True
End With
'Application.CommandBars.ActiveMenuBar.Enabled = False
Application.ScreenUpdating = True
Set cb = Nothing
End Sub
When I select Cancel from the Save dialog, the Workbook Menu bar and the other bars that were visible before are not showing. From the intermediate window they are enabled and the Visibility is true. I hav a feeling they are being covered up by somthing but I cannot figure out what for sure.
Any Ideas?
Public Sub EverythingOff()
Application.ScreenUpdating = False
Dim cb As CommandBar
For Each cb In CommandBars
Application.ScreenUpdating = False
Debug.Print cb.Name
Debug.Print cb.Visible
If cb.Type < 3 Then cb.Enabled = False
Next cb
With ActiveWindow
.DisplayHeadings = False
.DisplayWorkbookTabs = False
End With
With Application
.DisplayFormulaBar = False
.DisplayFullScreen = True
.DisplayScrollBars = False
.DisplayStatusBar = False
End With
Set cb = Nothing
End Sub
and this code in Workbook_BeforeClose:
Public Sub EverythingOn()
Dim cb As CommandBar
For Each cb In CommandBars
Debug.Print cb.Name
Debug.Print cb.Visible
If cb.Type < 3 Then cb.Enabled = True
If cb.Name = "IWD" Then
cb.Enabled = False
End If
Next cb
With ActiveWindow
.DisplayHeadings = True
.DisplayWorkbookTabs = True
End With
With Application
.DisplayFullScreen = False
.DisplayFormulaBar = True
.DisplayScrollBars = True
.DisplayStatusBar = True
End With
'Application.CommandBars.ActiveMenuBar.Enabled = False
Application.ScreenUpdating = True
Set cb = Nothing
End Sub
When I select Cancel from the Save dialog, the Workbook Menu bar and the other bars that were visible before are not showing. From the intermediate window they are enabled and the Visibility is true. I hav a feeling they are being covered up by somthing but I cannot figure out what for sure.
Any Ideas?