VBA更改Activex按钮的名称

编程入门 行业动态 更新时间:2024-10-26 23:27:56
本文介绍了VBA更改Activex按钮的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

即使有可能,我也不确定.我想在单击时更改按钮的名称.

I am not sure, even if this is possible. I would like to change the named of the button when clicked.

我有Active X按钮,单击该按钮将在工作表上启用单元格.按钮启用工作表"的名称.

I have Active X button that will enable cells on the sheet when clicked. Name of the button "Enable Sheet".

启用后,他应该会看到一个禁用工作表"按钮.请告知.

Once he enables, he should see a button "Disable Sheet". Please advise.

推荐答案

假定您的按钮以"CommandButton1"命名:

assuming your button is named after "CommandButton1":

Private Sub CommandButton1_Click() With Me.OLEObjects("CommandButton1").Object .Caption = IIf(.Caption = "Enable Sheet", "Disable Sheet", "Enable Sheet") End With End Sub

在OP的评论后进行了编辑

edited after OP's comments

Private Sub CommandButton1_Click() With Me.OLEObjects("CommandButton1").Object .Caption = IIf(.Caption = "Enable", "Disable", "Enable") Range("E13:E14").Locked = .Caption = "Enable" End With End Sub

更多推荐

VBA更改Activex按钮的名称

本文发布于:2023-06-09 04:09:57,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/594947.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:按钮   名称   VBA   Activex

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!