Trapping Keystrokes from Addin

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

Hi,
I have developed an Excel Addin using VB .NET and am trying to work out
how to capture keypress events.

I suspect it would follow the same principles as a COM

I see the Application.OnKey method, but this only seems to call an
excel macro. Is there any way for it to trigger an VB event.
Any ideas would be most appreciated.

Regards,
Peter
 
Hi Peter,
I have developed an Excel Addin using VB .NET and am trying to work out
how to capture keypress events.

I suspect it would follow the same principles as a COM

I see the Application.OnKey method, but this only seems to call an
excel macro. Is there any way for it to trigger an VB event.
Any ideas would be most appreciated.

Unfortunately, the Excel Application doesn't expose keyboard events for
external automation clients to bind to (be that COM Addins, VB6 or
VB.NET). The OnKey can only be used to call a VBA routine. This is one of
the reasons why I recommend incorporating VB.NET into Excel-based
applications by exposing them as COM Classes, loaded and controlled by a
VBA wrapper addin.

Regards

Stephen Bullen
Microsoft MVP - Excel
www.oaltd.co.uk
 

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