Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Nov 2003
    Location
    Christchurch, Canterbury
    Posts
    122
    Thanks
    27
    Thanked 1 Time in 1 Post

    Macro shortcuts for Add-ins (2000)

    Is it possible to link a macro in an ..xla to a shortcut key? If so, how? (I tried Application.MacroOptions Macro:="MySaveAs", HasShortcutKey:=True, ShortcutKey:="S" but it came up telling me I can't do this to a hidden workbook)

    Alternatively, does anyone know what the system Save command is called? (In Word I can simply create a public sub called FileSave - so much simpler. This doesn't work in Excel)

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro shortcuts for Add-ins (2000)

    IN your workbook_OPen event code place this line:

    Application.Onkey "s", "MySaveAs"

    Unlike Word, in Excel there are no "system" commands, so you cannot create a single macro named identical to a system command and thus have all actions that would normally invoke the system command redirected to your macro.

    There are two possible methods to circumvent this:

    - a class module with an application_beforesave event
    - redirecting all (!) controls that cause the save to happen to your macro

    There is a third possibility (excel 2000 an d up) but it will be published in a book about Excel development (highly recommended for developers) but I am under NDA so I cannot reveal that one.
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  3. #3
    2 Star Lounger
    Join Date
    Nov 2003
    Location
    Christchurch, Canterbury
    Posts
    122
    Thanks
    27
    Thanked 1 Time in 1 Post

    Re: Macro shortcuts for Add-ins (2000)

    Thanks for that. The OnKey works a treat.

  4. #4
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro shortcuts for Add-ins (2000)

    <hr>The OnKey works a treat.<hr>
    Yes, once you have figured out not to use "s" but "^s" to make sure you didn't catch the normal letter s instead of control-s <smile>
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •