tags:

views:

23

answers:

1

I would like to be able to handle a Ctrl+x keypress event from within Excel (where x can be any defined key), such that the keypress will invoke a VSTO method on the worksheet which does some calculations and then sets a value in the currently selected cell. I haven't been able to find an event to handle this in VSTO (there seem to be mouse events, and activate/deactivate events on a worksheet, but no keypress events).

I have toyed with using a VBA macro to handle the Ctrl+x keypress event, then getting VBA to call VSTO, but I don't want to go down this road if there is an easier way of doing it.

The question is what is the easiest or generally accepted method for doing this sort of thing?

+1  A: 

It looks like this StackOverflow answer should be useful: http://stackoverflow.com/questions/1010723/daemon-in-c-to-listen-for-keypress

Mathias