从表单控件按钮返回AlternativeText

时间:2017-06-22 15:45:18

标签: excel-vba vba excel

有没有办法从表单控件按钮中获取替代文本?

以下适用于形状:

Debug.Print Activesheet.Shapes(Application.Caller).AlternativeText

但是,对于按钮,这不起作用:

Debug.Print Activesheet.Buttons(Application.Caller).AlternativeText

是否可以退回此属性?

1 个答案:

答案 0 :(得分:0)

尝试以下方法:

ActiveSheet.Buttons(Application.Caller).ShapeRange.AlternativeText

Button对象没有AlternativeText属性,但它有[{1}}且ShapeRange属于AlternativeText。< / p>

将来,分配给一个对象变量,并在调试时使用ShapeRange窗口在运行时检查对象的属性。通常你可以围绕属性&amp;找到你需要的东西!

enter image description here