Stopping prompt to save template when doc is created or open.

B

BRC

I have a template that contains some links to an excel file. Every
time I create or open a file based on this template I get prompted to
save the template (my template.dotm). I've been searching for the
solutionn to this for a couple of days now and I am either not using
correct search criteria or there is not a lot of info on this. I see
sevarl posts about prompts to saveth "normal" template but they
havn't help me find out how to stop this prompt. Thanks for any
advice.
 
G

Graham Mayor

If you have links to an external file contained in a template, the warning
you usually get is concerned with updating links i.e.
This document contains links that may refer to other files. Do you want to
update this document with the data from the linked files?

You shouldn't get a prompt to save the template when you *open* the
document. You will however get a prompt when you *close* the document which
reflects that the document template has changed. I am not sure whether it is
desirable or even possible to over-ride this warning.


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Gordon Bentley-Mix

Perhaps a simple AutoClose macro in the template

ActiveDocument.AttachedTemplate.Saved = True

would do the trick?

I haven't tested this under the conditions described by the OP, but I base
this recommendation on my own experience arising from the following
situation:

In many of my templates I create and destroy a custom toolbar using AutoOpen
and AutoClose macros and setting the CustomizationContext to the attached
template. Normally, I wouldn't expect this to make the template "dirty", as
removing the toolbar sets the template back its original state. However,
under certain circumstances (usually as a result of a catastrophic failure
during development resulting in a "legacy" toolbar remaining in the
template), the toolbar already exists in the template when a document based
on the template is opened, and removing it *does* make the template dirty.
Then the user is prompted to save the template, which generally doesn't work
all that well because the environment doesn't allow most users to save to
the Workgroup templates folder. By including the above line of code in my
AutoClose macro, I can convince Word that the template has been saved so the
user isn't prompted.

An alternative might be to programmatically save the template using

ActiveDocument.AttachedTemplate.Save

but this will only work if the user has permission to write to the folder
containing the template - something that my users can't do. (Took me ages to
work that out because whenever I tested this approach it worked fine since I
had full permissions on the Workgroup templates folder.)

Like I said, I haven't tested this for this particular situation, but it
seems like it should work. My recommendation is to "suck it and see".
 
B

BRC

Perhaps a simple AutoClose macro in the template

ActiveDocument.AttachedTemplate.Saved = True

would do the trick?

I haven't tested this under the conditions described by the OP, but I base
this recommendation on my own experience arising from the following
situation:

In many of my templates Icreateand destroy a custom toolbar using AutoOpen
and AutoClose macros and setting the CustomizationContext to the attached
template. Normally, I wouldn't expect this to make the template "dirty", as
removing the toolbar sets the template back its original state. However,
under certain circumstances (usually as a result of a catastrophic failure
during development resulting in a "legacy" toolbar remaining in the
template), the toolbar already exists in the template when a document based
on the template is opened, and removing it *does* make the template dirty..
Then the user is prompted to save the template, which generally doesn't work
all that well because the environment doesn't allow most users to save to
the Workgroup templates folder. By including the above line ofcodein my
AutoClose macro, I can convince Word that the template has been saved so the
user isn't prompted.

An alternative might be to programmatically save the template using

ActiveDocument.AttachedTemplate.Save

but this will only work if the user has permission to write to the folder
containing the template - something that my users can't do. (Took me agesto
work that out because whenever I tested this approach it worked fine since I
had full permissions on the Workgroup templates folder.)

Like I said, I haven't tested this for this particular situation, but it
seems like it should work. My recommendation is to "suck it and see".
--
Cheers!

Gordon Bentley-Mix








- Show quoted text -

Gentleman, Thanks for the responses. I have been distracted by other
things going on but will test these options after holidays.
BRC
 

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