Hide toolbars when file opens

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

Rob Gould

Hi all,

I have created a file for people to use to get quotes. When the file
opens, I do not want them to have access to any toolbars. How can I
hide these when the file is opened, but only for this file - not any
others that the user may subsequently open. All that they may need to
do, is print the page out after getting a quote.

Many thanks.

Rob
 
You can use this in the Thisworkbook module Rob

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
 
Thanks Ron - That is great. Can you add code so that the formula
bar, and sheet tabs are also hidden? Also, there are 3 worksheets in
this file. I need the same settings on all sheets - at the moment,
the second and third sheets still show the row and column headings,
which I would like hidden as per sheet 1.

Many thanks for your help.

Regards,

Rob
 
Hi Rob
and sheet tabs are also hidden
row and column headings

This things will be saved with the file
Change it in Tools>Options and save the file

For the formulabar/statusbar you can use this
Run the subs in the Activate and Deactivate event

copy the code below in a normal module

Dim Sbar As Boolean
Dim fbar As Boolean

Sub hide()
Dim bar As CommandBar
For Each bar In Application.CommandBars
bar.Enabled = False
Next
fbar = Application.DisplayFormulaBar
Sbar = Application.DisplayStatusBar
With Application
.DisplayFormulaBar = False
.DisplayStatusBar = False
End With
End Sub

Sub show()
Dim bar As CommandBar
For Each bar In Application.CommandBars
bar.Enabled = True
Next
With Application
.DisplayFormulaBar = fbar
.DisplayStatusBar = Sbar
End With
End Sub
 
Back
Top