Barb, thank you for response.
Unfortunately I don't think this is the case. The third-party addon
I'm dealing with seems to behave properly (unlike UML). Actually I was
able to reproduce the issue I'm fighting with (last menu cannot be
changed using "UIObject" model) using pure VBA only.NB: I was able to
change that last menu item using "CommandBars" technology.
Unfortunately my current project customization is bound to UIObjects,
so moving to CommandBars does not sound any fun. Actually, the real
issue is not the last menu item (it's nothing compared to world-wide
revolution
, the issue I can't bear with is that I'm unable to
change the context (right-click) menu using UIObjects under these
conditions (i.e. when two addins are installed and both of them have
done some customization to application-level custom menu). I guess
this might be the same problem, since for context menu there is only
one item in the menu (and thus it is the last one).
So here are the steps to reproduce the issue (I'm working with Visio
2007 Pro, Windows XP SP3)
1. Start Visio.
2. Customize Visio menu manually. E.g. add extra menu item. This
imitates the activity of that third-party-addon. Like this:
http://nbelyh.googlepages.com/visiomenu1.png
3. Run the code below to customize the menu. This time it will work
(!)
4. Close Visio (this will save custom ui)
5. Start Visio again.
6. Run the same code to customize menu once again. This time it will
NOT work for the last menu item (!!!). And this is the problem...
-----
Sub Demo()
Set cm = Application.CustomMenus
Set mnus = cm.MenuSets.ItemAtID(visUIObjSetDrawing).Menus
Set mi1 = mnus.Item(mnus.Count - 2).MenuItems.Add
mi1.Caption = "WORKS ALWAYS"
Set mi2 = mnus.Item(mnus.Count - 1).MenuItems.Add
mi2.Caption = "THE PROBLEM"
cm.UpdateUI
End Sub
-----
The empty drawing that contains that code can be found here:
http://nbelyh.googlepages.com/visiomenu1.vsd
Any help?
Kind regards, Nikolay.