Custom menu crashes visio when deleting on close.

J

Jeremy Gollehon

Hi. I use the following code in Excel and Word to remove my custom menus
when I close my workbooks or documents. For some reason it crashes Visio
when doing the same thing. Is this known problem? Is there a workaround?

Thanks.
-Jeremy

-------------------------------------------------------------------
Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

On Error Resume Next
With Application.CommandBars.ActiveMenuBar
.Controls("NameOfMenu").Delete
End With

End Sub
-------------------------------------------------------------------
 
J

JuneTheSecond

Application.CommandBars.ActiveMenuBar.Controls("A Name").Delete
works in my Visio.
 
J

Jeremy Gollehon

Hi JuneTheSecond,
Thanks for the reply. If I run the code from the VBE it works fine. It's
when it's automated from the Document_BeforeDocumentClose event that causes
the problem.

Does it work from that event in your Visio?

Thanks for the help.
-Jeremy
 

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