Using Caller with sub-menu selection in 2007

K

Kevin Beckham

I use the Application.Caller to return the menu item from a menu containing
sub-menus that each use the same macro function. While the upper level items
still work, there is no longer any differentiation for the sub-menu items.
Code did work for 2003 and earlier but not for 2007. Have I missed something ?

dim c as variant
c= Application.Caller
if c(4)= 0 then ' menu item
'select actual course of action
select case c(1)
case 1
case 2
case else
end select
elseif c(4) = 11 then ' 11th item in menu is a sub-menu
'select actual course of action for sub-menu
select case c(1)
case 1
case 2
case else
end select
endif

TIA
 
J

Jim Cone

I don't use XL2007, but the "ActionControl" property may still work.
Give it a try.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)




"Kevin Beckham"
wrote in message
I use the Application.Caller to return the menu item from a menu containing
sub-menus that each use the same macro function. While the upper level items
still work, there is no longer any differentiation for the sub-menu items.
Code did work for 2003 and earlier but not for 2007. Have I missed something ?

dim c as variant
c= Application.Caller
if c(4)= 0 then ' menu item
'select actual course of action
select case c(1)
case 1
case 2
case else
end select
elseif c(4) = 11 then ' 11th item in menu is a sub-menu
'select actual course of action for sub-menu
select case c(1)
case 1
case 2
case else
end select
endif

TIA
 
K

Kevin Beckham

Thanks Jim

I didn't want to have to set a different ActionContol (and hence different
processing procedure) for each menu item, 30-40 including sub-menus, as the
handling is essentially the same. The code still works for the items on the
menu but not for item on sub-menus, i.e. Caller is broken in 2007

Kevin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top