Width Property

Applies To

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

Description

Returns or sets the width (in pixels) of the specified command bar or command bar control. Read/write Long.

See Also

Height 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 custom 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, Id:=4, Before:=2, Temporary:=True)
With myControl
    .Height = barheight / 2
    .Width = 50
End With
myBar.Visible = True