OK... Found it myself this morning...
It was the < > at the start and end of both server names that was throwing it...
Here is the working version...
Now all I need to do is get it to read through sub folders too...
---------------
Sub rename_temp_dir()
Dim strFilePath As String
Dim strPath As String
Dim intCounter As Integer
Dim strFileName As String
Dim OldServer As String
Dim NewServer As String
Dim objDoc As Document
Dim objTemplate As Template
Dim dlgTemplate As Dialog
OldServer = "\\b091-jonw\templates"
NewServer = "\\south_hunsley\templates"
strFilePath = InputBox("What is the folder location that you want to use?")
If Right(strFilePath, 1) <> "\" Then strFilePath = strFilePath & "\"
strFileName = Dir(strFilePath & "*.doc")
Do While strFileName <> ""
Set objDoc = Documents.Open(strFilePath & strFileName)
Set objTemplate = objDoc.AttachedTemplate
Set dlgTemplate = Dialogs(wdDialogToolsTemplates)
strPath = dlgTemplate.Template
If LCase(Left(strPath, 21)) = LCase(OldServer) Then
objDoc.AttachedTemplate = NewServer & Mid(strPath, 22)
End If
strFileName = Dir()
objDoc.Save
objDoc.Close
Loop
Set objDoc = Nothing
Set objTemplate = Nothing
Set dlgTemplate = Nothing
End Sub



LinkBack URL
About LinkBacks

Reply With Quote
