Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

VBA to collect double click from 'MX Revolution' mouse?

  Asked By: Nichole    Date: Dec 27    Category: MS Office    Views: 1867
  

I recently bought a Logitech "MX Revolution" mouse. (I highly
reccomend it because it has a counterweigted roller wheel that lets
you zip around a spreadsheet at high speed.) Anyways, it's got some
extra buttons that I connected macros too, (like trace precedents and
trace dependants) but now I want more buttons.

I would like to write a macro that gets executed when I press one of
the mouse buttons. But if I double click the button, the macro will
detect this and launch an alternate routine.

And all the button does is send a keystroke combination that I assign
to the computer.

Can anyone point me in the right direction?

Share: 

 

3 Answers Found

 
Answer #1    Answered By: Rocco Anderson     Answered On: Dec 27

I am not familiar with your nice mouse  or its buttons, but here (in
stripped-down form) is the code I use to remap the double-click event:

Private Sub Auto_Open()
'Redefine the double-click event to call the DblClick sub.
Application.OnDoubleClick = "DblClick"
End Sub

Public Sub DblClick()
'New event logic for double-click.
MsgBox "Double-click code goes here", vbInformation, "DblClick"
End Sub

Private Sub Auto_Close()
'Restore the double-click key event to normal.
Application.OnDoubleClick = ""
End Sub

To make this work all the time, put the code in a module in your hidden
Personal.xls workbook.

Please note: some Excel add-ins, such as Hyperion SmartView for Office, may
contend with you for control of the double-click event, causing errors.

 
Answer #2    Answered By: Scott Simmons     Answered On: Dec 27

I guess I wasn't as clear as I could have
been about my issue. What my mouse  does is send  a keystroke
combination to the computer. So when I send a double-click, I really
send something like "Ctrl-I" twice in rapid succession. I would like
to write  a routine  that detects the time between clicks and either
interprets it as a single click  or a double  click.

I was thinking the routine could pause after the first "Ctrl-I" and
wait a specified interval for the next "Ctrl-I". But I'm not sure
what to wait for.

Any idea how I could do this?

 
Answer #3    Answered By: Raju Srinivas     Answered On: Dec 27

Search for the topic "Time capture of less than one second" in this
group. I gave a Google groups link there, and Pascal also had a
solution.

This will enable you to monitor time in great detail.

To implement, start the code, waiting for the user to CTRL-I, start the
timer upon the first keystroke of "CTRL-I", and wait for x counts (x to
be defined by you). If after x counts, no second event, then reset
timer, and wait again. If second event within x counts, then execute
whatever code.

What I am unsure of is how to capture the keystroke (Don't know what the
code for CTRL-I is). Secondly how to limit the amount of processing
power this code will use, as it will continuously be monitoring stuff
from VBA. But only one way to find out.

 
Didn't find what you were looking for? Find more on VBA to collect double click from 'MX Revolution' mouse? Or get search suggestion and latest updates.




Tagged: