AttachedTemplate doesn'twork

AttachedTemplate doesn'twork

Post by ASB » Wed, 02 Jun 2004 02:54:30


I'm using Word automatisation from access to do a merge.
After the merge I want a specific line of text to appear on the ne
merged document ( the user builds his own mergedocument wit
mergefields i supply him with ), while the user can't prevent this lin
I thought the best way to do this is to make a simple template wit
this line of text and then attach this template after the merge ha
completed. in order to do this i use activedocument.attachedtemplate
however, this thing doesn'twork through automatisation, or else I'
doing something wrong.
Someone can help me?



AttachedTemplate doesn'twork

Post by J. Verdaas » Fri, 04 Jun 2004 02:57:56

Hi Alain, :D

Normally I check the active attached template in the code and after
that's confirmed by the code I change the attachment to another


Sub ChangeReference()
If LCase(ActiveDocument.AttachedTemplate) = "hi" Then
With ActiveDocument
.UpdateStylesOnOpen = False
.AttachedTemplate = NormalTemplate
End With
End If
End Sub


Try this while using a break point in you're code and step tru it whit
F8! (Check to see if all code lines are passed)

Please note the LCase Function you must supply the name of the template
in Lower Case.

Enjoy, ;)

Message posted from


AttachedTemplate doesn'twork

Post by Cindy M -W » Fri, 04 Jun 2004 22:25:43

Hi Asb,

I'm not certain I understand what you want to have happen. Do you think,
by attaching a template, that text within that template will
automatically appear in a document?

No, Word doesn't function like that.

Further more, there are very limited possibilities in Word for putting
text in a document that the user can't "touch".

We can discuss this further, if you wish, but you do need to tell us
which version of Word is involved.

Cindy Meister
INTER-Solutions, Switzerland (last update Sep 30 2003)

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)