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