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

CommandBar.Height Property (Office)

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

Gets or sets the height of a CommandBar. 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. Height

expression A variable that represents a CommandBar object.

Return Value



This example adds a custom control to the command bar named Custom. The example sets the height of the custom control to twice the height of the command bar and sets the control's width to 50 pixels. Notice how the command bar automatically resizes itself to accommodate the control.

Set myBar = CommandBars("Custom") 
barHeight = myBar.Height 
Set myControl = myBar.Controls _ 
    .Add(Type:=msoControlButton, _ 
    Id:= CommandBars("Standard").Controls("Save").Id, _ 
With myControl 
    .Height = barHeight * 2 
    .Width = 50 
End With 
myBar.Visible = True

See also


CommandBar Object

Other resources

CommandBar Object Members

© 2018 Microsoft