Share via


CommandBarButton.Height Property

Office Developer Reference

Gets or sets the height of a command bar control. Read/write.

Aa432909.vs_note(en-us,office.12).gif  Note
The use of CommandBars in some Microsoft Office applications has been superseded by the new Ribbon user interface. For more information, search help for the keyword "Ribbon."

Syntax

expression.Height

expression   A variable that represents a CommandBarButton object.

Return Value
Integer

Example
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.

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

See Also