Autoclose

A

acherony

Hi!

Sub Autoclose()

On Error Resume Next

Application.CommandBars("Menu
Bar").Controls("&Company").Delete

End Sub

I have created menu and I would like to deleted it when document close.
It is working, but if I made changes in doc and then I close doc the
Autoclose will be executed and after that come pop-up window with "Do you
want to save the changes yes/no/cancel) if I press cancel I will go back to
the doc, but my menu is already gone while the Autoclose was executed.

any idea how could I solve this problem.

It is working with close() with Savechanges:=true, but I don´t want to do
that while I could close doc w/out saving.

thanks
 
J

Jezebel

When you add the commandbar, flag it as temporary. Then it is discarded
automatically when Word closes.
 
A

acherony

Hi, I don´t know why but it is not working. I flag it as temporary but Menu
is still there after I close document.

I create the Menu and flag it as Temporary and then I save it to normal.dot
and I think Temporary works when do unloads the Template not when you close
doc.

It works in if you don´t use normal.dot. Any othor ideas Jezebel!

By the way thanks for your quick response!
 
J

Jezebel

Menus are attached to templates, not documents. Create a template that
contains you menu, and use that to create your document.
 

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