M
MrTodd
I have a Word 2003 template (*.dot) that contains the following line of code
to attach the normal template (for the purpose of removing the link between
the source template and the resulting document):
ActiveDocument.AttachedTemplate = NormalTemplate
When I use this template in Word 2007, this line gives a Run-time Error:
5947 'Could not change document template.' This happens if the template
resides on my Windows Desktop or in another nontrusted location. If I place
the file in my Templates folder (a trusted location), then this line seems to
work without a problem.
The reason this is a potential problem is that I intend to distribute the
template companywide, and cannot assume everyone will go to the effort of
placing the template in a trusted location. I assume some people will simply
double-click the template file to generate a new documant.
Things I have tried:
-- moving the code to a module, vs. a 'Document_New' subroutine in
'ThisDocument'
-- using a Word 2007 template (*.dotm)
In each of these cases, the trusted location still seems to be the factor
that determines whether or not I get an error. And if I create a new
document from the template in Word 2003, the code runs fine without the
error, no matter where the template is saved.
Am I correct in thinking this is related to the template being in a
trusted/nontrusted location? Does anybody have experience with this issue,
and is it possible there is another cause for this error?
Thank you.
Todd
to attach the normal template (for the purpose of removing the link between
the source template and the resulting document):
ActiveDocument.AttachedTemplate = NormalTemplate
When I use this template in Word 2007, this line gives a Run-time Error:
5947 'Could not change document template.' This happens if the template
resides on my Windows Desktop or in another nontrusted location. If I place
the file in my Templates folder (a trusted location), then this line seems to
work without a problem.
The reason this is a potential problem is that I intend to distribute the
template companywide, and cannot assume everyone will go to the effort of
placing the template in a trusted location. I assume some people will simply
double-click the template file to generate a new documant.
Things I have tried:
-- moving the code to a module, vs. a 'Document_New' subroutine in
'ThisDocument'
-- using a Word 2007 template (*.dotm)
In each of these cases, the trusted location still seems to be the factor
that determines whether or not I get an error. And if I create a new
document from the template in Word 2003, the code runs fine without the
error, no matter where the template is saved.
Am I correct in thinking this is related to the template being in a
trusted/nontrusted location? Does anybody have experience with this issue,
and is it possible there is another cause for this error?
Thank you.
Todd