Customizing Visio menu?

N

Nikolay Belyh

I've got a strange problem with Visio menu customization.
IF there already is a custom visio ui when I try to install my ui,
then some of my menu items do not
appear.nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
 
B

Barb Way

Some add-ins (both Visio built-in and third party) use the Built-In menus
and toolbars by default, rather than grabbing the current context when they
are opened. This means that your customizations are not retained while the
solution or add-in is open. UML and Database modeling are known to have
this problem, and third party tools like the Adobe PDFMaker also exhibits
the problem. There's no way to change this behavior, and it occurs in all
versions of Visio.


Barb Way
Product Support - Visio
Microsoft Corporation
[This posting is provided "As Is" with no warranties, and confers no
rights.]
--------------------

I've got a strange problem with Visio menu customization.
IF there already is a custom visio ui when I try to install my ui,
then some of my menu items do not
appear.nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
 
N

Nikolay Belyh

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.
 

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