Some of the content in this topic may not be applicable to some languages.
Returns or sets the way a command bar is protected from user customization. Read/write MsoBarProtection.
MsoBarProtection can be one of these MsoBarProtection constants. |
msoBarNoChangeDock |
msoBarNoChangeVisible |
msoBarNoCustomize |
msoBarNoHorizontalDock |
msoBarNoMove |
msoBarNoProtection |
msoBarNoResize |
msoBarNoVerticalDock |
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
Next
If Not foundFlag Then
MsgBox "'Forms' command bar is not in the collection."
End If