Reputation: 916
I have a VBA form in Excel with "Next" and "Previous" buttons that update an Image control's picture source.
I would like to be able to click these buttons very quickly in succession in order to loop through the images. However, when I click twice in short succession (double click) I only get one response.
I suspect that this is the case because there is a double click event on the button that gets triggered instead of the click event when two clicks are very close to each other.
My goal would be to disable the double-click event altogether, allowing me to click the button as quickly as I want. Is there a way to do that?
Upvotes: 1
Views: 2882
Reputation: 916
I actually figured out a pretty easy workaround for this:
In the DoubleClick event, I can simply call the Click event like so:
Private Sub NextBtn_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
NextBtn_Click
End Sub
I am now able to click the button as fast as I want and after each click the same code is executed.
Upvotes: 0
Reputation: 2065
Regular command buttons might not be the best control; what you're doing sounds like it calls more for a spin button (the one with the next/back control).
If that doesn't cut it, the stupidly simple solution would be to have the double click even simply call the click event twice.
Upvotes: 0