Remove Formula Bar / Toolbars etc

C

cassy01

Can anybosy please tell me how to remove all the users toolbars and
formulae bars when the workbook is opened and then put them all back
when the workbook is closed?

Many Thank
Benn
 
B

Bob Phillips

Option Explicit

Private mFormulaBar

Private Sub Workbook_Open()
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_BeforeClose(Cancel As Boolean)
Dim oCB As CommandBar

'Restore commandbars
For Each oCB In Application.CommandBars
oCB.Enabled = True
Next

'RestoreFormulaBar
Application.DisplayFormulaBar = mFormulaBar
End Sub


'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code





--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
D

Dana DeLouis

Can anybody please tell me how to remove all the users toolbars and
formulae bars

Just throwing this out as a possible alternative...

Sub FullScreenToggle()
With Application
.DisplayFullScreen = Not (.DisplayFullScreen)
End With
End Sub

Perhaps in the Workbook_Open / Workbook_BeforeClose event.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top