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.
 

Some videos you may like

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

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
 

Watch MrExcel Video

Forum statistics

Threads
1,122,521
Messages
5,596,648
Members
414,083
Latest member
Mrsash

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