Code to hide window elements in a specific file

  • Thread starter Thread starter Rob Gould
  • Start date Start date
R

Rob Gould

Hi there,

I have the following code which works to remove toolbars when a
specific file is opened. But I would also like for the formula bar,
status bar and sheet tabs to be hidden when the file is opened. These
must, however, all be visible again when any other file is opened.
Please help!


Code in This Workbook:
Private Sub Workbook_Activate()
Dim bar As CommandBar
For Each bar In Application.CommandBars
bar.Enabled = False
Next
End Sub

Private Sub Workbook_Deactivate()
Dim bar As CommandBar
For Each bar In Application.CommandBars
bar.Enabled = True
Next
End Sub
 
Take a look under Tools|Options|View Tab.

You'll see the 3 things that you want to toggle. And you could record a macro
when you do it once to get the code.
 
Back
Top