ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   prevent doubleclick for command button (https://www.excelbanter.com/excel-programming/420555-prevent-doubleclick-command-button.html)

Gina

prevent doubleclick for command button
 
Hello!

I have several command buttons that has assigned macros to get a particular
record and delete it. How can I ensure that double-click for the command
button is disabled?

Alan Moseley

prevent doubleclick for command button
 
As far as I can see, if you do double-click a command button, the button's
click event is fired once only. If you don't have an event handler for
double clicking, then just the click event will fire.

Anyway, in answer to your question, in the VBA code window choose your
command button from the object combo and then select DblClick from the
procedure combo. This adds an event handler to your code. Within this sub
just type :-

Cancel=True

--
Alan Moseley IT Consultancy
http://www.amitc.co.uk

If I have solved your problem, please click Yes below. Thanks.


"Gina" wrote:

Hello!

I have several command buttons that has assigned macros to get a particular
record and delete it. How can I ensure that double-click for the command
button is disabled?


royUK[_64_]

prevent doubleclick for command button
 

Try this


Code:
--------------------
Option Explicit

Private Sub CommandButton1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Cancel = True
End Sub
--------------------


--
royUK

Hope that helps, RoyUK
For tips & examples visit my 'web site
' (http://www.excel-it.com)
------------------------------------------------------------------------
royUK's Profile: http://www.thecodecage.com/forumz/member.php?userid=15
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=34156



All times are GMT +1. The time now is 05:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com