jammer6_9
04-17-2007, 05:29 AM
When a workbook activates I wanted all Toolbars disabled. Below code works but I want it in one statement only. Is there any way to write this command in just one statement?
Private Sub Workbook_Activate()
Application.CommandBars("Standard").Enabled = False
Application.CommandBars("Formatting").Enabled = False
Application.CommandBars("borders").Enabled = False
Application.CommandBars("Chart").Enabled = False
Application.CommandBars("Control Toolbox").Enabled = False
Application.CommandBars("Drawing").Enabled = False
Application.CommandBars("External Data").Enabled = False
Application.CommandBars("Forms").Enabled = False
Application.CommandBars("Formula Auditing").Enabled = False
Application.CommandBars("List").Enabled = False
Application.CommandBars("Pictures").Enabled = False
Application.CommandBars("PivotTable").Enabled = False
Application.CommandBars("Protection").Enabled = False
Application.CommandBars("Reviewing").Enabled = False
Application.CommandBars("Text To Speech").Enabled = False
Application.CommandBars("Visual basic").Enabled = False
Application.CommandBars("Watch Window").Enabled = False
Application.CommandBars("WordArt").Enabled = False
Application.CommandBars("CheckBoxes").Enabled = False
Application.CommandBars("Flow Connectors").Enabled = False
Application.CommandBars("Flow Shapes").Enabled = False
Application.CommandBars("Excel Add-in for Analysis Service").Enabled = False
Application.CommandBars("Custom 1").Enabled = False
Application.CommandBars("Custom 2").Enabled = False
End Sub
Private Sub Workbook_Activate()
Application.CommandBars("Standard").Enabled = False
Application.CommandBars("Formatting").Enabled = False
Application.CommandBars("borders").Enabled = False
Application.CommandBars("Chart").Enabled = False
Application.CommandBars("Control Toolbox").Enabled = False
Application.CommandBars("Drawing").Enabled = False
Application.CommandBars("External Data").Enabled = False
Application.CommandBars("Forms").Enabled = False
Application.CommandBars("Formula Auditing").Enabled = False
Application.CommandBars("List").Enabled = False
Application.CommandBars("Pictures").Enabled = False
Application.CommandBars("PivotTable").Enabled = False
Application.CommandBars("Protection").Enabled = False
Application.CommandBars("Reviewing").Enabled = False
Application.CommandBars("Text To Speech").Enabled = False
Application.CommandBars("Visual basic").Enabled = False
Application.CommandBars("Watch Window").Enabled = False
Application.CommandBars("WordArt").Enabled = False
Application.CommandBars("CheckBoxes").Enabled = False
Application.CommandBars("Flow Connectors").Enabled = False
Application.CommandBars("Flow Shapes").Enabled = False
Application.CommandBars("Excel Add-in for Analysis Service").Enabled = False
Application.CommandBars("Custom 1").Enabled = False
Application.CommandBars("Custom 2").Enabled = False
End Sub