Height Property

Applies To

CommandBar object, CommandBarButton object, CommandBarComboBox object, CommandBarControl object, CommandBarPopup object.

Description

Returns or sets the height of the specified command bar or command bar control, in pixels. Read/write Long.

Remarks

Setting the Height property will cause an error if the command bar isn't in a resizable state (that is, if it's docked or protected from resizing).

See Also

Controls property.

Example

This example adds a custom control before the second control on the command bar named "Custom." The example sets the height of the control to half the height of the command bar and sets its width to 50 pixels.

Set myBar = cmdbar.CommandBars("Custom")
barHeight = myBar.Height
Set myControl = myBar.Controls _
    .Add(Type:=msoControlComboBox, Before:=2, Temporary:=True)
With myControl
    .Height = barHeight / 2
    .Width = 50
End With
myBar.Visible = True