I'm sooo close now, it works but gives an error after it finishes, will try and work it out but for the moment, here it is..
Code:
Function WordTemplateFix()
Dim $strFilePath,$strPath,$intCounter,$strFileName,$OldServer,$objDoc,$objTemplate,$dlgTemplate,$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")
Do While $strFileName <> ""
$Word = CreateObject("Word.Application")
$objDoc = $Word.Documents.Open($strFilePath + $strFileName)
$objTemplate = $objDoc.AttachedTemplate
$dlgTemplate = $Word.Dialogs(wdDialogToolsTemplates)
$strPath = $dlgTemplate.Template
If Lcase(InStr($strPath, $nServer)) = Lcase($OldServer)
$objDoc.AttachedTemplate = $Word.NormalTemplate
EndIf
$strFileName = Dir("")
$Save = $objDoc.Save
$Close = $objDoc.Close
Loop
$objDoc = ""
$objTemplate = ""
$dlgTemplate = ""
EndFunction
WordTemplateFix ()
Thanks for your help Shawn and Lonkero
Cheers,
Grasshopper75