C
CiaraG
Good afternoon,
After reading through a number of questions on the newsgroup re.
hiding/restoring toolbars and commandbars. I chose the code below to use in
my VBA project. The code works find except when a user click on the x button
in the top right hand of the workbook. In this instance the workbook closes
and the commandbars/toolbars are NOT restored. Does someone know a work
around to this problem?? All ideas much appreciated.
Option Explicit
Private mFormulaBar
Private Sub Workbook_Activate()
Dim oCB As CommandBar
'Remove commandbars
For Each oCB In Application.CommandBars
oCB.Enabled = False
Next
'RemoveFormulaBar
mFormulaBar = Application.DisplayFormulaBar
Application.DisplayFormulaBar = False
End Sub
Private Sub Workbook_Deactivate()
Dim oCB As CommandBar
'Restore commandbars
For Each oCB In Application.CommandBars
oCB.Enabled = True
Next
'RestoreFormulaBar
Application.DisplayFormulaBar = mFormulaBar
End Sub
After reading through a number of questions on the newsgroup re.
hiding/restoring toolbars and commandbars. I chose the code below to use in
my VBA project. The code works find except when a user click on the x button
in the top right hand of the workbook. In this instance the workbook closes
and the commandbars/toolbars are NOT restored. Does someone know a work
around to this problem?? All ideas much appreciated.
Option Explicit
Private mFormulaBar
Private Sub Workbook_Activate()
Dim oCB As CommandBar
'Remove commandbars
For Each oCB In Application.CommandBars
oCB.Enabled = False
Next
'RemoveFormulaBar
mFormulaBar = Application.DisplayFormulaBar
Application.DisplayFormulaBar = False
End Sub
Private Sub Workbook_Deactivate()
Dim oCB As CommandBar
'Restore commandbars
For Each oCB In Application.CommandBars
oCB.Enabled = True
Next
'RestoreFormulaBar
Application.DisplayFormulaBar = mFormulaBar
End Sub