2

through our software, our clients can create Word documents based on a number of templates we provide. This has caused us some problems lately when sites have been moving servers, as documents created from templates have a link to the original template's path and attempt to connect to that path when opening the created documents (even when 'Automatically update document styles' is turned off).

So, when these sites have moved servers, there can be a large, unacceptable delay in opening documents while it tries to resolve a network path that doesn't exist anymore.

I've found ways to handle this for existing documents (see below) but I want to stop this issue from propagating in the future.

Does anyone know how to set up Word so that new documents created from templates will not have a link to the template? (so just use Normal instead).

Thanks

Also, if anyone else reading this is having this issue, the following links should be helpful:

A Powershell script to clear the attached template links.

A registry setting to control the timeout time when the document is attempting to connect to the template path.

Luke
  • 1,218
  • 1
  • 24
  • 40

2 Answers2

1

In the VBA for your templates you can use the AttachedTemplate property to attach the Normal template (or any other template) to new documents. For example:

 Private Sub Document_New()

 ActiveDocument.AttachedTemplate = "C:\Users\Joe\AppData\Roaming\Microsoft\Templates\Normal.dotm"

 End Sub
joeschwa
  • 3,083
  • 1
  • 21
  • 41
  • Yeah, this is probably the best (only?) solution using Word itself I've seen. Unfortunately won't work for me (won't go into why) and I've had to solve this by clearing the template with a call from the c# code that creates the document from the template in the first place. I can't believe the isn't just a setting in Word to disable the propagation of the template path if you don't want it to. – Luke Nov 28 '12 at 19:22
1

The correct way is :

Private Sub Document_New()

   ActiveDocument.AttachedTemplate = ""

End Sub

This will make a reference to normal.dotm.

cshptr
  • 11
  • 1