简体   繁体   中英

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:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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