Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi ,
I would like to know if it possible to catch a shotcut and trigger a procedure in a c# com addin? Does someone has an example of this? Thx Manu |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi Manu, I still don't know where and how Excel stores shortcuts, but here's my way to launch a C# routine with a shortcut. Create a C# Class Library, i.e. COMSAMPLE.cs which looks like this: using System; using System.Runtime.InteropServices; namespace COMSAMPLE { /// <summary /// Summary description for Class1. /// </summary public class Class1 { public Class1() { } public string FileVersion() { return "C# COM Sample Version 1.0 by Me"; } } } Nothing more, nothing less. Make sure you set Register for COM Interop to True in the project properties and then compile. In Excel, start Macro Recorder, make Ctrl-Shift-K (or any other) the shortcut and click OK. Do nothing but just stop recording 'cos now we have our desired shortcut. Finally, in the recorded macro: Sub Macro2() Dim x, s As String Set x = CreateObject("COMSAMPLE.Class1") s = x.FileVersion MsgBox s Set x = Nothing End Sub schreef in bericht ps.com... Hi , I would like to know if it possible to catch a shotcut and trigger a procedure in a c# com addin? Does someone has an example of this? Thx Manu |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
shortcut has change or move so this shortcut can not open | Excel Worksheet Functions | |||
Shortcut key | Excel Discussion (Misc queries) | |||
Shortcut | Excel Discussion (Misc queries) | |||
Shortcut | Excel Programming | |||
Shortcut Key | Excel Programming |