Invalid Path to File in Templates & Add-ins Word 2000

D

David

Since retiring an old server, may user Word 2000 documents take minutes to
open rather than seconds. After poking about within the slow files, I found
a reference to the old server in Tools > Templates and Add-Ins, in the
Document template box. Deleteing the box contents and saving the file fixes
the problem; file opens nice and fast after that. But opening each and every
file to fix will take hours and hours (lots of users and files). I noticed
that after deleting the bad reference and saving, Normal appears in the box.
Is there a fast way to replace the offending reference with Normal? Is there
a way to turn off saving the template used to create new documents?
Thanks for the help!
David
 
G

Graham Mayor

You could run the following macro on a folder and it will apply the normal
template to all the documents in that folder. Enter the path to normal.dot
in the relevant place near the end of the macro to reflect your own
installation:

Sub ApplyNormalTemplate()
Dim myFile As String
Dim PathToUse As String
Dim myDoc As Document

With Dialogs(wdDialogCopyFile)
If .Display <> 0 Then
PathToUse = .Directory
Else
MsgBox "Cancelled by User"
Exit Sub
End If
End With

If Documents.Count > 0 Then
Documents.Close Savechanges:=wdPromptToSaveChanges
End If

If Left(PathToUse, 1) = Chr(34) Then
PathToUse = Mid(PathToUse, 2, Len(PathToUse) - 2)
End If

myFile = Dir$(PathToUse & "*.doc")

While myFile <> ""
Set myDoc = Documents.Open(PathToUse & myFile)
ActiveDocument.AttachedTemplate = "D:\Word Templates\normal.dot"

myDoc.Close Savechanges:=wdSaveChanges
myFile = Dir$()
Wend
End Sub

See http://www.gmayor.com/installing_macro.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
C

Charles Kenyon

There is no way to turn off the saving of the template used to create a new
document. In some cases I have an AutoNew macro in my templates that
switches the attached template to normal.dot (to avoid this problem, among
others).

If you are up to programming, you can write a program that cycles through
all documents in a folder and switches their attached template to
normal.dot. There is an example of a program that goes through all files in
a folder in the vba FAQ on the MVP FAQ site. It is used to find and replace
but you can change the code. If you need help with this, ask in the
vba.beginners newsgroup.
 
D

David

Thank you so much!

Graham Mayor said:
You could run the following macro on a folder and it will apply the normal
template to all the documents in that folder. Enter the path to normal.dot
in the relevant place near the end of the macro to reflect your own
installation:

Sub ApplyNormalTemplate()
Dim myFile As String
Dim PathToUse As String
Dim myDoc As Document

With Dialogs(wdDialogCopyFile)
If .Display <> 0 Then
PathToUse = .Directory
Else
MsgBox "Cancelled by User"
Exit Sub
End If
End With

If Documents.Count > 0 Then
Documents.Close Savechanges:=wdPromptToSaveChanges
End If

If Left(PathToUse, 1) = Chr(34) Then
PathToUse = Mid(PathToUse, 2, Len(PathToUse) - 2)
End If

myFile = Dir$(PathToUse & "*.doc")

While myFile <> ""
Set myDoc = Documents.Open(PathToUse & myFile)
ActiveDocument.AttachedTemplate = "D:\Word Templates\normal.dot"

myDoc.Close Savechanges:=wdSaveChanges
myFile = Dir$()
Wend
End Sub

See http://www.gmayor.com/installing_macro.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
D

David

Thanks for your help!

Charles Kenyon said:
There is no way to turn off the saving of the template used to create a
new
document. In some cases I have an AutoNew macro in my templates that
switches the attached template to normal.dot (to avoid this problem, among
others).

If you are up to programming, you can write a program that cycles through
all documents in a folder and switches their attached template to
normal.dot. There is an example of a program that goes through all files
in
a folder in the vba FAQ on the MVP FAQ site. It is used to find and
replace
but you can change the code. If you need help with this, ask in the
vba.beginners newsgroup.
 
G

Graham Mayor

You are welcome :)

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top