Try something along the lines of:
[vba]Sub AddDocumentHyperlinks()
Application.ScreenUpdating = False
Dim strFolder As String, strFile As String, wdDoc As Document
Dim FndArray As Variant, RepArray As Variant
FndArray = Array("ABC", "XYZ")
RepArray = Array("www.microsoft.com", "www.google.com")
strFolder = GetFolder
If strFolder = "" Then Exit Sub
strFile = Dir(strFolder & "\*.doc", vbNormal)
While strFile <> ""
Set wdDoc = Documents.Open(FileName:=strFolder & "\" & strFile, AddToRecentFiles:=False, Visible:=False)
For i = LBound(FndArray) To UBound(FndArray)
With wdDoc.Content
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = FndArray(i)
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = True
.MatchCase = True
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute
End With
Do While .Find.Found = True
.Duplicate.Hyperlinks.Add Anchor:=.Duplicate, Address:=RepArray(i), _
SubAddress:="", ScreenTip:="", TextToDisplay:=FndArray(i)
.Start = .Duplicate.Hyperlinks(1).Range.End
.Find.Execute
Loop
End With
Next
wdDoc.Close SaveChanges:=True
strFile = Dir()
Wend
Set wdDoc = Nothing
Application.ScreenUpdating = True
End Sub
Function GetFolder() As String
Dim oFolder As Object
GetFolder = ""
Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0)
If (Not oFolder Is Nothing) Then GetFolder = oFolder.Items.Item.Path
Set oFolder = Nothing
End Function[/vba]