Sub ReplaceWithHyperlink(mobjDoc As Document)
Dim rng As Word.Range
Dim hyp As Word.Hyperlink
Set rng = mobjDoc.Range
Do While rng.Find.Execute("%ApplicantOnlineTimesheetsLink%")
Set hyp = mobjDoc.Hyperlinks.Add(rng, "http://www.myurl.com/")
Set rng = hyp.Range
rng.Collapse wdCollapseEnd 'make sure that the new hyperlink text is not included in the search
rng.End = mobjDoc.Range.End 'extend the Find range to the end of the document
Loop
End Sub
|