ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Trapping Keystrokes from Addin (https://www.excelbanter.com/excel-programming/320586-trapping-keystrokes-addin.html)

Peter[_51_]

Trapping Keystrokes from Addin
 
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


Stephen Bullen[_4_]

Trapping Keystrokes from Addin
 
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




All times are GMT +1. The time now is 11:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com