Word thinks a template is being changed?

B

Byron

This line of code is in a VB6 app that opens Word and creates a new
document based on one of 350 templates. This line of code is making
Word change the Saved property of the template from true to false.
When the user saves the document, Word also changes the date of the
template. The variable is declared as a Date

vTemplateRevisionDate =
..ActiveDocument.AttachedTemplate.BuiltInDocumentProperties("Last save
time").Value

I added "If .ActiveDocument.AttachedTemplate.Saved = False then
..ActiveDocument.AttachedTemplate.Saved = True" as a workaround but I'd
like to know why it's happening in the first place.

Thanks,
Byron
 
B

Billy Ray

Byron said:
This line of code is in a VB6 app that opens Word and creates a new
document based on one of 350 templates. This line of code is making
Word change the Saved property of the template from true to false.
When the user saves the document, Word also changes the date of the
template. The variable is declared as a Date

vTemplateRevisionDate =
..ActiveDocument.AttachedTemplate.BuiltInDocumentProperties("Last save
time").Value

I added "If .ActiveDocument.AttachedTemplate.Saved = False then
..ActiveDocument.AttachedTemplate.Saved = True" as a workaround but I'd
like to know why it's happening in the first place.

Thanks,
Byron


You no ask VB6 question here. This Word forum, no VB6. Learn right thing.
 
D

Doug Robbins

It's one of those things, if you access the Document Properties collection,
you dirty the document/template whose Properties you are accessing.

You don't really need the IF construction, just add

ActiveDocument.AttachedTemplate.Saved = True

--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
 
B

Byron

Thank you Doug. It still seems a bit odd that reading a property
"changes" a template but oh well. I changed the line of code as well.
 
Top