Example:
Hyperlink is
\\MyServer\FolderXXXX\SubFolder\PlanningTools\2007\_Category\2007Priorities
byChannel.ppt
Replace with:
\\MyServer\FolderXXXX\SubFolder\PlanningTools\2008\_Category\2008Priorities
byChannel.ppt
Does anyone know of an easy way to do this? I'd rather not edit each
individually...
Thanks
TOMB
Sub demo()
Const sOld = "2007"
Const sNew = "2008"
Dim oHyper As Hyperlink
For Each oHyper In ActiveDocument.Hyperlinks
With oHyper
.Address = Replace(.Address, sOld, sNew)
.TextToDisplay = Replace(.TextToDisplay, sOld, sNew)
End With
Next
End Sub
The .TextToDisplay is what you see in the document, while the .Address is
the URL passed to the browser, and they aren't necessarily the same. The
macro takes care of changing both of them.
If "2007" isn't present in a particular hyperlink, that one won't be
changed. If it's present more than once, as in the example you showed, the
Replace function will change all of them in one shot.
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
TOMB