Issue with Custom Menu - stencil to drawing

B

ben h

Hi hi,

I have a stencil file (vss) which houses my 'solution' code, designed
specifically for my drawing template file.

I have a UIObject menu that I create on startup of the stencil file
(Document_DocumentOpened event), however there are a few problems that
come with that.

We have the Adobe PDFMaker add-in, and there often seems to be some
conflict between that add-in's menu and my menu.

Scenario:
No instance of Visio open, I fire up the template by double-clicking it
within explorer; the template is linked to the stencil file which opens
as well. The stencil menu is created and is visible, however the Adobe
menu isn't. NOTE: I'm talking about the menu, not the Adobe toolbar,
which isn't affected.

So to workaround this I wrote a quick procedure that clears my menu,
then creates it again (by first removing Custom menus, and by removing
the reference of the stencil file from the drawing file, then doing the
reverse).

-----
Public Sub ResetMenu()
Dim vsoDocument As Visio.Document
Set vsoDocument = Visio.ActiveDocument

Call Clear_Custom_Menus
Call modUIObjects.AddStencilReference(vsoDocument)
Call modUIObjects.AddUIItems(vsoDocument)

Set vsoDocument = Nothing
End Sub

Public Sub Clear_Custom_Menus()
Call modUIObjects.DeleteDocCustomUI
Call modUIObjects.RemoveStencilReference(Visio.ActiveDocument)
End Sub
-----

When this is fired the Adobe menu appears along with mine (Adobe menu
first), and a Visio-generated error appears:

"An error (1801) occurred during the action Close Window. This file is
currently referenced by another file and cannot be closed."

Can't find any references to this error message anywhere, and don't know
what is causing it!


So, how do I get my menu to play nicely with the Adobe menu, and is
there a better way to create menus anyway in Visio 2003?

Ben
 

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