Log in

View Full Version : Reset Template Path



kmb
06-23-2017, 04:06 PM
I can view ActiveDocument.AttachedTemplate.Path in Word but I can't change it.
And because the AttachedTemplate does not use relative paths, the document is easily broken when it can't find the Template
-made up example: original: \\C-Server1\Public\Documents\Templates\myTemplate.dotm
had moved to new server now: \\C-Server2\All Documents\theTemplates\myTemplate.dotm
how do I reset the AttachedTemplate.Path in VBA to reflect the updated absolute path?
If I remove the 'IsBroken' reference, I am unable to replace it. I just need to reset the path in VBA

Paul_Hossler
06-23-2017, 04:25 PM
Not sure why you can't change it. In VBA this bit will change the attached template from Letter.dotx (which is is MyTemplates folder) to Normal.dotm in Roaming



Sub Macro1()
With ActiveDocument
' .UpdateStylesOnOpen = False
.AttachedTemplate = Environ("APPDATA") & "\Microsoft\Templates\Normal.dotm"
End With
End Sub


If I go to the [Developer] tab and then use [Document Templates], I can do the same using the GUI