After running the mail merge, I use the code below to turn e-mail addressed into hyperlinks, but the text gets indented.
Code:
Sub MakeLinks()
Application.ScreenUpdating = False
Dim Rng As Range
With ActiveDocument
Set Rng = .Range
With .Range
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.text = "<[0-9A-ÿ.\-]{1,}\@[0-9A-ÿ\-.]{1,}"
.Replacement.text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchWildcards = True
.Execute
End With
Do While .Find.Found
.Duplicate.AutoFormat
.Collapse wdCollapseEnd
.Find.Execute
Loop
.End = Rng.Start
With .Find
.text = "http://[! ]{1,}"
.Execute
End With
Do While .Find.Found
.Duplicate.AutoFormat
.Collapse wdCollapseEnd
.Find.Execute
Loop
End With
End With
Application.ScreenUpdating = True
End Sub
Without creating a table for each mail merge field, can this be overcome? In the mail merge template, the e-mail is preceded by a phone number, which is this case is blank. I have tab stops setup in the mail merge template to space out the phone number followed by the e-mail.