Running Excel Macro from External Trigger

N

Nick

Can anyone help me to run a macro from an external
trigger - such as a pressing the third mouse button
without the pointer at a specific part of the screen?

I have an Excel macro that I want to run whenever a sensor
beam is broken. It is easy enough to connect the beam to
simulate a mouse click, but I cannot find any way to make
VBA recognise such an event.

Nick
 
T

Tushar Mehta

Can the hardware/software you use to detect the beam break simulate a
right click? Or a double click? Those generate worksheet (or chart)
level _BeforeRightClick or _BeforeDoubleClick events respectively.

Alternatively, if all you can do is get the equivalent of a mouse
click, *try* the following: Create a button that fills up the screen.
That way irrespective of the location of the mouse, the code associated
with the button should run.

A final idea. The only objects that support a click event are those
associated with a form. So, create and show a form that fills up the
entire screen. Then, have supporting code in the Userform's _Click
event.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 

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

Top