Width Property
Returns or sets the width (in pixels) of the specified command bar or command bar control. Read/write Integer.
expression.Width
*expression * Required. An expression that returns one of the objects in the Applies To list.
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 its 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, _
Temporary:=True)
With myControl
.Height = barHeight * 2
.Width = 50
End With
myBar.Visible = True
Applies to | CommandBar Object | CommandBarButton Object | CommandBarComboBox Object | CommandBarControl Object | CommandBarPopup Object
See Also | Height Property