Thank you Josie and Pauley for your answers. This is very helpful I thought I hit a wall on that one but it seems that it could work.
The mouseup event works by using the code below from this website:
http://www.vbaexpress.com/forum/show...MouseUp-Events
Option Explicit
Enum MouseButtons
fmButtonLeft = 1 'The left button was pressed.
fmButtonRight = 2 'The right button was pressed.
fmButtonMiddle = 4 'The middle button was pressed.
End Enum
Private Sub TextBox1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Select Case Button
Case fmButtonLeft
MsgBox "The left button was pressed"
Case fmButtonRight
MsgBox "The right button was pressed"
Case fmButtonMiddle
MsgBox "The middle button was pressed"
End Select
End Sub
It seems that it is possible to use the KeyUp event but I can’t get that one to work yet. Here is the code I found:
Private Sub Textbox1_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyLeft Then
MsgBox "Left arrow"
ElseIf KeyCode = vbKeyRight Then
MsgBox "Right arrow"
End If
End Sub
I found it on this website.
http://vbcity.com/forums/t/12201.aspx
However I get the following error message:
Compile error:
Procedure declaration does not match description of event or procedure having the same name.
Is this to do with the declaration of KeyCode and Shift?
Thank you for your help
JL
Bookmarks