简体   繁体   English

将宏分配给按钮表单控件(有限制)

[英]Assign Macro to button form control (with restrictions)

I'm looking to do the following: 我想做以下事情:

Assign a macro to a form control button, but only let the user press this button once. 将宏分配给窗体控制按钮,但只允许用户按下此按钮一次。 Once the button is pressed once it shouldn't be possible to press it again. 一旦按下按钮,就不可能再次按下它。 I'm trying to prevent accidental clicking of the button. 我试图防止意外单击该按钮。 The macro is sending a quantity to an accounting spreadsheet so I don't want to send anything twice by accident. 宏正在向会计电子表格发送数量,所以我不想偶然发送两次。

I guess you could use the "Enabled" property, like: 我猜您可以使用“ Enabled”属性,例如:

Sub CommandButton1_Click()
    CommandButton1.Enabled = False
    ...
End Sub

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM