View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Orlando Magalhães Filho Orlando Magalhães Filho is offline
external usenet poster
 
Posts: 35
Default Trapping the mouse

Hi Sam K,

If talk about mouse click on worksheets, unfortunately there are only two
events for mouse: Double click and Right click. If you want to test them,
try this:

- Open your Workbook
- Right click sheet tab
- Click View Code command
- Insert the code below:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
MsgBox "You double click at " & Target.Address
Cancel = True 'This avoid default behavior
End Sub

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
MsgBox "You right click at " & Target.Address
Cancel = True 'This avoid default behavior
End Sub


- Press Alt+F11 to back Excel window
- Try double click and right click the sheet cells.


HTH

---
Orlando Magalhães Filho

(So that you get best and rapid solution and all may benefit from the
discussion, please reply within the newsgroup, not in email)


"Sam K" escreveu na mensagem
...

I would like to trap a key stroke before processing some code and then
activating the stroke after.
Can I do something similar to a mouse click?

Thanks in advance for any clue,
Sam K