document on close

F

Fred Kruger

I have created a toolbar which is created when the document_new is fired the
problem is I have set the delete function in the document_close procedure so
whe the document is clsoed it deletes the toolbar so it is not left.

the problem is when the toolbar is deleted it then asks if i want to save
changes to the template on which the document was created is there a way of
stopping this message box from appearing and not saving the changes.

Cheers in anticipation

Fred
 
J

Jean-Guy Marcil

Fred Kruger was telling us:
Fred Kruger nous racontait que :
I have created a toolbar which is created when the document_new is
fired the problem is I have set the delete function in the
document_close procedure so whe the document is clsoed it deletes the
toolbar so it is not left.

the problem is when the toolbar is deleted it then asks if i want to
save changes to the template on which the document was created is
there a way of stopping this message box from appearing and not
saving the changes.

Cheers in anticipation

You do not need to delete the toolbar form the template.
Manually create it and save the template.

Thus, whenever a document is created or opened from the template, the
toolbar will be available and will not be displayed if the user switches
from a document based on this template to another document based on a
different template.

Now, if you must do it the VBA way, whenever you make a change to the
toolbar by code, at the end of the toolbar changing code, add:

ThisDocument.Saved = True

This way Word will think that the template has not been dirtied.

Note that if the user added AutoText entries to the template, they will not
be saved. So make sure you know what you are doing, and more importantly,
that you know what the user will do with that template before using this.


--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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