Toolbars = Off

Mike E Golding

Board Regular
Joined
Mar 7, 2002
Messages
71
I have a macro which runs when each sheet is activated to hide the toolbars which have been opened by other:
Sub TOOLBARS_OFF()
Application.DisplayFormulaBar = False
Application.DisplayStatusBar = False
Application.CommandBars("Standard").Visible = False
Application.CommandBars("Formatting").Visible = False
Application.CommandBars("Chart").Visible = False
Application.CommandBars("Control Toolbox").Visible = False
Application.CommandBars("Drawing").Visible = False
Application.CommandBars("External Data").Visible = False
Application.CommandBars("Forms").Visible = False
Application.CommandBars("Picture").Visible = False
Application.CommandBars("PivotTable").Visible = False
Application.CommandBars("Reviewing").Visible = False
Application.CommandBars("Visual Basic").Visible = False
Application.CommandBars("Web").Visible = False
Application.CommandBars("WordArt").Visible = False
End Sub

Please can anyone tell me whether I can use a one liner.
Thanks for any help. Mike.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Yesuslave

Active Member
Joined
Sep 19, 2003
Messages
297
Sub TOOLBARS_OFF()
Application.DisplayFormulaBar = False
Application.DisplayStatusBar = False
i = Application.CommandBars.Count
On Error Resume Next
For j = 2 To i
Application.CommandBars(j).Visible = False
Next

End Sub

Good Luck,
Josh
 

Seti

Well-known Member
Joined
May 19, 2002
Messages
2,916
Don't know about simplifying the code, but there are a bunch of other toolbars available that you are not closing. For example, I always have the auditing toolbar open. To see all of them, right click the menu area and select customize to see all of them.
 

Mike E Golding

Board Regular
Joined
Mar 7, 2002
Messages
71
Thankss a million to both Yesuslave and Seti. I finally got time to get back and will get into both replies...Thanks again...Mike
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,167,954
Messages
5,856,493
Members
431,818
Latest member
AKEMAROD

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top