Thanks for the response.
Adding menu items to a shortcut menu is very easy in Excel, as I think most
people know. That was the basic model that I was following/looking for in
MSProject. As both of our experiences seem to confirm, this particular menu
structure is not progammically available to add menu items into within the
MSProject environment.
I have been able to progammatically build, display and traverse a substitute
shortcut menu in MSProject 2002/2000 after the user executes some action;
that is, I can display my shortcut menu instead of the default MSProject
shortcut menu for the given context utilizing the various MSProject events
suchs as "BeforeTaskNew". I can even do this dynamically based upon content
in a particular field of a record in a Gantt chart, for example. This is all
done with the standard CommandBar family of objects with the parent menu
defined as a msoBarPopup.
The last challenge that I have run into is that MSProject will not execute
the associated procedure specified in the "OnAction" property of a menu item
defined as a msoControlButton. It just quietly returns after selecting the
menu item . The exact same definition in a popup defined and inserted in the
"Menu Bar", the conventional menu presented across the top of MSProject,
works fine.
I have experimented from a number of perspectives assuming that it may be
scope/name resolution issue, but without success. Apparently MSProject is
not wired to examine this property and dispatch the call.
My next idea was to see if the MSProject "menu handler/dispatcher" left a
clue as to the selected item in some global variable that I could use to
select a procedure after the ShowPopup. No luck so far.
There are clues/evidence of this problem scattered around the web. In
particular, MSDN talks about an almost identical problem in Office 2003 with
the recommendation to make the "tag" property a unique string. One fact that
seems to confirm the "not wired" idea is that MSDN article talked about
needing a "withevents" on the button declaration.
Another approach to this is to make a custom user dialog that looks and acts
like a menu. You can capture mouse events with the Windows API and map to
procedures accordingly . . . a lot of work for menus.
Kirk