Capture right click in text box

  • Thread starter Thread starter XP
  • Start date Start date
X

XP

Using Office 2003 and Windows XP;

I know you can trap a double-click on a textbox on a form.

Is it possible to capture a right mouse click on a text box on a form?

If so, how is it done using VBA (or otherwise)? Could someone please post
generic example code?

Thanks much in advance.
 
Private Sub Text0_MouseDown(Button As Integer, Shift As Integer, _
X As Single, Y As Single)
If Button = acRightButton Then
MsgBox "You pressed the right button."
End If
End Sub
 
Thanks Douglas;

One more thing, I noticed that there is no cancel in the sub. How can I
cancel the normal built-in right click menu in the code?

Thanks again.
 

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

Back
Top