CommandButton

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

how can i make a
CommandButton2_Click()

so i shall use the mouse to click and not working whit return

regards alvin
 
Hi
normally this procedure should be invoked if you click the button with
your mouse. What does exactöy not work for you?
 
The commandbutton will have (should have) a property called Default. Set
that property to False.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Hi
I have done that but it dosn't work
if i use tab from one textbox to antother and
down to the commandbutton so the commandbutton
highlites and then use the return/enter button
then i activate the command button so i shall
have a way to cancel the return button

regards Alvin


"Bob Phillips" skrev:
 
Hi Alvin,
Use this code to only process the Click event of COmmandButton2 when it
comes from the Mouse and not from the Keyboard.
- set the Default property of the CommandButton2 to False
- In the userform code:
'-------------------------------------------------------
Private ClickType As Long '1 if LEFT_CLICK, else 0

Private Sub CommandButton2_KeyDown(ByVal KeyCode As MSForms.ReturnInteger,
ByVal Shift As Integer)
ClickType = 0
End Sub

Private Sub CommandButton2_MouseDown(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
ClickType = IIf(Button = 1, 1, 0)
CommandButton2_Click
End Sub

Private Sub CommandButton2_Click()
If ClickType = 1 Then
MsgBox "ok"
'... your code for Click here <-----
End If
End Sub
'------------------------------------------------------

Regards,
Sebastien
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top