Table of contents
Collapse the table of content
Expand the table of content

CommandBar.Protection Property (Office)

office 365 dev account|Last Updated: 6/12/2017
1 Contributor

Gets or sets a MsoBarProtection constant representing the way a command bar is protected from user customization. Read/write.

Note The use of CommandBars in some Microsoft Office applications has been superseded by the new ribbon component of the Microsoft Office Fluent user interface. For more information, search Help for the keyword "ribbon."


expression. Protection

expression A variable that represents a CommandBar object.


Using the constant msoBarNoCustomize prevents users from accessing the Add or Remove Buttons menu (this menu enables users to customize a toolbar).


This example steps through the collection of command bars to find the command bar named "Forms." If this command bar is found, it's docking state is protected and it's made visible.

foundFlag =  False 
For i = 1 To CommandBars.Count 
    If CommandBars(i).Name = "Forms" Then 
            CommandBars(i).Protection = msoBarNoChangeDock 
            CommandBars(i).Visible = True  
            foundFlag = True  
    End If 
If Not foundFlag Then 
    MsgBox "'Forms' command bar is not in the collection." 
End If

See also


CommandBar Object

Other resources

CommandBar Object Members

© 2018 Microsoft