Re: Add-In Keyboard Shortcut

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



From the users standpoint, I have a series of macro's that can only run from
a menu (as opposed to going into the code and running the macro). However,
each iteration of my .xla file (which stores the macro's) I change this menu.

So, I want to be able to automatically (via ctrl+shift+d sounds great!) to
change their pre-existing menu to the current one i worked on.

you say it's unconventional to have an entire module dedicated to adding a
menu (AddMenu). You also say you think it wise to add a menu from within
another module. Is that what you're saying? I'm not sure if I follow... this
line of thinking.

I also think i'm in way over my head :-/ But, it's pretty close....

thanks a lot for your time and effort!!!!,
-m

"Peter T" wrote:

I'm glad you've got it working but not sure I understand your follow-up
question.

You need to run the code that assigns the shortcut to your AddMenu proc,
typically from an open event which might also add a menu. There's no need
for the proc to have run once before it will work from the shortcut.

It's unusual to have a shortcut that runs code to add menu items, at least I
assume that's what AddMenu does. More conventional would be to have both the
OnAction property of a menu item and your shortcut linked to a procedure
that starts some functional aspect of your addin.

Regards,
Peter T

"mvyvoda" <mvyvoda@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:C83E9F19-731B-4E59-941E-128ED186DC7B@xxxxxxxxxxxxxxxx
oh... I misnamed AddMenu. It works now, however I have a final question. I
have a scenario whereby I need this ctrl+shift+D to work in a situation
where
someone has never ran the AddMenu routine. Is this possible? Or, do I have
to
run AddMenu with the added ctrl+shift+D code before they can use
ctrl+shift+D?

If you follow?

Thanks,
-m

"mvyvoda" wrote:

I got rid of the menu already in place to test to see if the
ctrl+shift+D
would work if only personal.xla was in place and never ran. also, i did
rename the file, to no avail.

I don't have any other macro's that are similarly named.

AddMenu is a pretty typical routine that merely adds a menu, names it
and
places arguments (attached to macros of course) within the menu.

Peter, I really appreciate all your help!!,
-m

"Peter T" wrote:

Why do you "get rid of the menu already in place"

Is AddMenu a Sub with no arguments

Do you have a similarly named AddMenu sub in any other workbook (incl
addins), if so did you prefix the way I suggested.

Apart from your Personal.xla do you also have Personal.xls, if so try
renaming the addin.

Regards,
Peter T

"mvyvoda" <mvyvoda@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:5047FA80-1A39-40C9-98E5-662C086183DB@xxxxxxxxxxxxxxxx
Peter,

When I do this, and get rid of the menu already in place (but run
your
code)
I get an error:

The macro" C:\..\AddIns\personal.xla'!AddMenu' cannot be found

do you what this means?

Thanks,
-m

"Peter T" wrote:

Application.OnKey "+^D", "MyMacro"

This should create a shortcut Shift-Ctrl-D. If there's any
possibility
MyMacro may exist in any other workbook prefix with
ThisWorkbook.Name &
"!".
Call it from an Open event.

Not sure about naming your addin "Personal.xla" if there may also
be a
Personal.xls open, guess it's OK but I wouldn't.

Regards,
Peter T

"mvyvoda" <mvyvoda@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:DC406180-E22C-41BC-B5D9-7C3613A6D056@xxxxxxxxxxxxxxxx
i am using an add-in to store macro's ("personal.xla" in
C:\Documents
and
Settings\mvyvoda\Application Data\Microsoft\AddIns). I need to
have a
keyboard shortcut to one fuction within this add-in. The macro
list
(Alt-F8)
does not list any macro's in personal.xla.

i'm not even sure where to start.

thanks,
-m









.



Relevant Pages

  • Re: Add-In Keyboard Shortcut
    ... You need to run the code that assigns the shortcut to your AddMenu proc, ... that starts some functional aspect of your addin. ... Peter, I really appreciate all your help!!, ...
    (microsoft.public.excel.programming)
  • Re: Add-In Keyboard Shortcut
    ... "Peter T" wrote: ... You need to run the code that assigns the shortcut to your AddMenu proc, ... typically from an open event which might also add a menu. ...
    (microsoft.public.excel.programming)
  • Re: Add-In Keyboard Shortcut
    ... someone has never ran the AddMenu routine. ... Peter, I really appreciate all your help!!, ... renaming the addin. ... The macro list ...
    (microsoft.public.excel.programming)
  • Re: Add-In Keyboard Shortcut
    ... have an unfortunately long-ish AddMenu module. ... "Peter T" wrote: ... You need to run the code that assigns the shortcut to your AddMenu proc, ... typically from an open event which might also add a menu. ...
    (microsoft.public.excel.programming)
  • Re: My .xla custom menu items doesnt show up when using 3rd party software
    ... Thanks, Peter. ... Sub Auto_Close ... Dim cbcTools As CommandBarControl ... My routine only attempted to open only your own addin (none of any other ...
    (microsoft.public.excel.programming)