CommandBar.Visible property (Office)

Gets or sets the Visible property of the command bar. True if the command bar is visible. 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, see Overview of the Office Fluent ribbon.

Syntax

expression.Visible

expression A variable that represents a CommandBar object.

Return value

Boolean

Remarks

The Visible property for newly created custom command bars is False by default.

The Enabled property for a command bar must be set to True before the Visible property is set to True.

Example

This example steps through the collection of command bars to find the Forms command bar. If the Forms command bar is found, the example makes it visible and protects its docking state.

foundFlag = False  
For Each cmdbar In CommandBars 
    If cmdbar.Name = "Forms" Then 
        cmdbar.Protection = msoBarNoChangeDock 
        cmdbar.Visible = True  
        foundFlag = True  
    End If 
Next 
If Not foundFlag Then 
    MsgBox "'Forms' command bar is not in the collection." 
End If

See also

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.