I have a script below that will change the server name in all the documents from x to y as we have moved servers and as a result the documents are still looking at the old server.
Can anyone help here to set this up to enable me to run the script and point out where to put the old server name and new?
http://support.microsoft.com/kb/830561/en-us?spid=2530&sid=36
Sub Test()
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 = "<\\rsnj01\vol1>"
NewServer = "<\\rsnyc1p\vol3>"
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, 13)) = LCase(OldServer) Then
objDoc.AttachedTemplate = NewServer & Mid(strPath, 14)
End If
strFileName = Dir()
objDoc.Save
objDoc.Close
Loop
Set objDoc = Nothing
Set objTemplate = Nothing
Set dlgTemplate = Nothing
End Sub
Can anyone help here to set this up to enable me to run the script and point out where to put the old server name and new?
http://support.microsoft.com/kb/830561/en-us?spid=2530&sid=36
Sub Test()
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 = "<\\rsnj01\vol1>"
NewServer = "<\\rsnyc1p\vol3>"
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, 13)) = LCase(OldServer) Then
objDoc.AttachedTemplate = NewServer & Mid(strPath, 14)
End If
strFileName = Dir()
objDoc.Save
objDoc.Close
Loop
Set objDoc = Nothing
Set objTemplate = Nothing
Set dlgTemplate = Nothing
End Sub