I have some button controls which fire off lengthy processing. Do I have to worry about the user pressing the button and firing off another execution while a first execution is active?
I found I could use the click events to disable the button, call the processing routine, and then enable the button. But this seems fraught with danger if the processing routine fails.
I could add on error stuff in the click routine to catch failures but would any on error calls in the processing routine cancel those out?
No – as long as there’s no chance there’s any code in your processing which calls
DoEvents.Try assigning the following code to a button in your worksheet (you may need to adjust the iterators higher to get sufficient runtime) and clicking an additional button – or doing anything else in Excel for that matter.
An added bonus is it helps illustrate how
.selectcauses slower operations in working with Excel…It is probably a good idea to include some sort of error handling regardless of simply reenabling buttons for any meaningful operations unless you are the sole user.
You would have to properly account for errors and the different places. The answer to this is “it depends on your implementation.”