Hiding Toolbars on Opening Workbook

paulw

New Member
Joined
May 6, 2002
Messages
6
What code would I need to hide ALL the Excel Toolbars/Formula Bar/Status Bar etc on opening a workbook?
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Sub Auto_Open()

Application.CommandBars("Standard").Visible = False
Application.CommandBars("Formatting").Visible = False
Application.CommandBars("Chart").Visible = False
Application.CommandBars("Clipboard").Visible = False
Application.CommandBars("Control Toolbox").Visible = False
Application.CommandBars("Drawing").Visible = False
Application.CommandBars("Exit Design Mode").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("PivotTable").Visible = False
Application.CommandBars("Stop Recording").Visible = False
Application.CommandBars("Visual Basic").Visible = False
Application.CommandBars("Visual Basic").Visible = False
Application.CommandBars("Web").Visible = False
Application.CommandBars("WordArt").Visible = False
End Sub

You might want to add an Auto_Close that undoes all this!!
 
Upvote 0
Auto_Open is an older feature, which may not continue to be supported. For newer versions, you might want the code in a Workbook Open event, stored in your ThisWorkbook module. (A shortcut to get to it is by right-clicking the "Excel" logo at the far left end of your menu bar -- next to "File" -- and choosing View Code; otherwise, choose "ThisWorkbook" from the Microsoft Excel Objects folder in your project in Visual Basic Editor.)

Code:
Sub Workbook_Open()
    'thanks to Corticus!
    With Application
        .CommandBars("Standard").Visible = False 
        .CommandBars("Formatting").Visible = False 
        .CommandBars("Chart").Visible = False 
        .CommandBars("Clipboard").Visible = False 
        .CommandBars("Control Toolbox").Visible = False 
        .CommandBars("Drawing").Visible = False 
        .CommandBars("Exit Design Mode").Visible = False 
        .CommandBars("External Data").Visible = False 
        .CommandBars("Forms").Visible = False 
        .CommandBars("Picture").Visible = False 
        .CommandBars("PivotTable").Visible = False 
        .CommandBars("PivotTable").Visible = False 
        .CommandBars("Stop Recording").Visible = False 
        .CommandBars("Visual Basic").Visible = False 
        .CommandBars("Visual Basic").Visible = False 
        .CommandBars("Web").Visible = False 
        .CommandBars("WordArt").Visible = False 

'and, to turn off other bars:
        .DisplayFormulaBar = False
        .DisplayStatusBar = False
        .ActiveWindow.DisplayWorkbookTabs = False

'just for fun, if you want to change the
'Title Bar from "Microsoft Excel" to "Whatever":
        .Caption = "Whatever"
    End With
End Sub

To turn it all back on when you're done, enter in same module:

Code:
Sub Workbook_BeforeClose(Cancel As Boolean)
    (same macro, change all "False" to "True", and set
    .Caption = Empty)          
End Sub

I'm sure there's a way to code "For Each command bar", set to "False" so you don't have to choose them all by name, but since I'm not 100% certain of the syntax off the top of my head, I'll let someone else clarify that. :)

Hope that helps,
Catherine
This message was edited by artslave on 2002-05-09 09:22
 
Upvote 0

Forum statistics

Threads
1,214,386
Messages
6,119,215
Members
448,874
Latest member
b1step2far

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
Back
Top