How to map a shortcut key to a routine in COM AddIn for Excel 2007
1. Background:
I have a COM addins developed in Visual basic 6.0 for EXCEL 2007. The COM
addin has its toolbar visible. It exposes customized 'Copy' as a button on
the toolbar, which will call MyCopyAction routine in the COM addin.
2. What I want:
I want to map a shortcut key for the customized 'copy' operation, which
indeed invoke the same routine as that on toolbar, i.e. MyCopyAction.
3. What I tried in the COM addin:
I added the following line in
Private Sub AddinInstance_OnStartupComplete(custom() As Variant)
....
Application.OnKey "+^c", "MyCopyAction"
....
End Sub
Problem was: Message box from EXCEL "cannot run the macro MyCopyAction ...".
MyCopyAction is not a macro. It's a routine in the COM AddIn. What options
do I have to make it work?
Thanks!
|