CommandBarControl.Height 属性 (Office)

获取或设置 CommandBarControl 控件的高度。 读/写。

注意

某些 Microsoft Office 应用程序中对 CommandBars 的使用已由 Microsoft Office Fluent 用户界面的新功能区组件取代。 有关详细信息,请参阅 Office Fluent 功能区概述

语法

表达式高度

表达 一个代表 CommandBarControl 对象的变量。

返回值

整数

示例

本示例将自定义控件添加到名为 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

另请参阅

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。