Hi all,

We've got a bunch of documents that have a template attached with a path that no longer exists. I'm making a small macro which replaces the non-existing path with a new one, but I've run into some problems.

It seems that if the missing template isn't found, the document defaults to Normal.dot (fair enough). But, I want to pull the path of the missing template out of the document. My code is:

VB Code:
  1. Sub FixTemplate()
  2. Set sCurrentTemplate = ActiveDocument.AttachedTemplate
  3.  sCurrentTemplate = LCase(sCurrentTemplate)
  4.  
  5. sOldTemplate = LCase("\\some_server\share\missing_template.dot")
  6.  
  7. If sCurrentTemplate = sOldTemplate Then
  8.     ActiveDocument.AttachedTemplate = "C:\program files\templates\text97.dot"
  9. End If
  10.  
  11. End Sub

This would work beautifully, except that ActiveDocument.AttachedTemplate is "Normal.dot" (since the otehr one can't be found). However, in the Templates and Add-Ins dialog, the path to the missing template is available.



Since the path is still there, I figure there's gotta be some way to pull it out, but damned if I can find it. Any hints?