Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Shortcut in c#

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Shortcut in c#


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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
shortcut has change or move so this shortcut can not open bakerstreet Excel Worksheet Functions 2 April 2nd 10 01:21 PM
Shortcut key Mary Ann Excel Discussion (Misc queries) 3 November 28th 09 04:37 PM
Shortcut SJT Excel Discussion (Misc queries) 1 February 23rd 07 06:17 PM
Shortcut Steph[_6_] Excel Programming 2 October 20th 05 12:19 AM
Shortcut Key ameliacat Excel Programming 1 October 23rd 04 05:03 PM


All times are GMT +1. The time now is 05:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"