目录

Width 属性

优质
小牛编辑
125浏览
2023-12-01

全部显示

以像素为单位返回或设置指定命令栏或命令栏控件的宽度。Integer 类型,可读写。

expression.Width

expression 必需。该表达式返回“应用于”列表中的对象之一。

示例

本示例在名为 Custom 的命令栏上添加一个自定义控件。本示例设置该自定义控件的高度为命令栏高度的两倍,并设置宽度为 50 像素。请注意命令栏如何自动调整自身以符合控件。

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