I ask so few questions here, I refuse to feel guilty asking for free coding.
The person this is for answers MANY questions at many free forums too, so I felt we could give them some help. They need to rename their network path, so it negates a bunch of hyperlinks in documents. I'd LOVE to do this for the guy:
An Excel workbook or maybe a Word table wherein he can type the FROM (old path) and the TO (new path). It opens each Word document in *this* folder and any subfolders of *this* folder (we'll have him move the file around to various folders), and turns field codes on, runs the find and replace (which won't work with field codes off), turn the field codes back on, save and close the file. I did record a macro that'll do it in one file, but I didn't save and close. Here's the code, cleaned up at least a little bit:
Sub Macro2()
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "\\\\newtonst-dc\\Gail\\"
.Replacement.Text = "\\\\unit2-dc\\Gail\\"
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.Execute Replace:=wdReplaceAll
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
'Save and close the file
'Loop through all files in this folder and subfolders
End Sub
I sooo much appreciate any help!!
Anne Troy
An Excel workbook or maybe a Word table wherein he can type the FROM (old path) and the TO (new path). It opens each Word document in *this* folder and any subfolders of *this* folder (we'll have him move the file around to various folders), and turns field codes on, runs the find and replace (which won't work with field codes off), turn the field codes back on, save and close the file. I did record a macro that'll do it in one file, but I didn't save and close. Here's the code, cleaned up at least a little bit:
Sub Macro2()
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "\\\\newtonst-dc\\Gail\\"
.Replacement.Text = "\\\\unit2-dc\\Gail\\"
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.Execute Replace:=wdReplaceAll
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
'Save and close the file
'Loop through all files in this folder and subfolders
End Sub
I sooo much appreciate any help!!
Anne Troy