View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Shortcut key for add-in macro (Excel 2007)

PS

Ensure the first line in the text editor is something like this (obviously
with the correct module name)

Attribute VB_Name = "Module1"

Peter T


"Peter T" <peter_t@discussions wrote in message
...
I didn't realise you were talking about an addin. Macros in addins are not
visible in the Alt-F8 dialog in any Excel version. Normally their macros
are called from a menu button or a shortcut created with OnKey in the Open
event (as I mentioned last time, see OnKey in help).

If you really want to use the shortcut method you'd apply via Alt-F8, the
only way (other than temporarily changing the IsAddin property) is to edit
the bas module in a text method

Export the bas module and remove it
In say Notepad add the first two lines after the macro name


Sub MyMacro()
Attribute MyMacro.VB_Description = "my Macro description"
Attribute MyMacro.VB_ProcData.VB_Invoke_Func = "D\n14"

' shortcutkey is Ctrl-Shift-d
Msgbox My Macro

End Sub

Import the bas module

I should add this is not the recommended way to do it, use OnKey

Regards,
Peter T