I've almost got it working, my only issue is that it stops after one file. Obviously it's something to do with the Do/Until or While/Loop.
Will keep pressing on. Here's the code so far
Code:
Function Test()
Dim $strFilePath
Dim $strPath
Dim $intCounter
Dim $strFileName
Dim $OldServer
Dim $objDoc
Dim $objTemplate
Dim $dlgTemplate
Dim $nServer
$Form = CreateObject("Kixtart.Form")
$OldServer = $Form.InputBox("What is the server name?")
$nServer = Len($OldServer)
$strFilePath = $Form.InputBox("What is the folder location that you want to use?")
If Right($strFilePath, 1) <> "\"
$strFilePath = $strFilePath + "\"
EndIf
$strFileName = Dir($strFilePath + "*.doc")
While $strFileName <> ""
$objDoc = Documents.Open($strFilePath + $strFileName)
$objTemplate = objDoc.AttachedTemplate
$dlgTemplate = Dialogs(wdDialogToolsTemplates)
$strPath = dlgTemplate.Template
If Lcase(Left($strPath, $nServer)) = Lcase($OldServer)
$rc = objDoc.AttachedTemplate = NormalTemplate
EndIf
$strFileName = Dir()
$rc = objDoc.Save
$rc = objDoc.Close
Loop
$objDoc = ""
$objTemplate = ""
$dlgTemplate = ""
EndFunction
Test ()