View Single Post
 
Old Today, 05:14 AM
gmaxey gmaxey is offline Windows 10 Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,626
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

You need .MatchWildCards = true


Code:
Sub MakeLinks()
'Adapted from code posted by Paul Edstein
  Application.ScreenUpdating = False
  With ActiveDocument
    With .Range
      With .Find
        .ClearFormatting
        .Replacement.ClearFormatting
        .Text = "<[0-9A-ÿ.\-]{1,}\@[0-9A-ÿ\-.]{1,}"
        .Forward = True
        .Wrap = wdFindStop
        .Format = False
        .MatchWildcards = True
      End With
      Do While .Find.Execute
        .Duplicate.AutoFormat
        .Collapse wdCollapseEnd
      Loop
    End With
    With .Range
      With .Find
        .Text = "http://[! ]{1,}"
        .MatchWildcards = True
      End With
      Do While .Find.Execute
        'If you want to remove the "http://" part, unstet next line.
        '.Text = Mid(.Text, 8, Len(.Text) - 7)
        .Duplicate.AutoFormat
        .Collapse wdCollapseEnd
      Loop
    End With
  End With
  Application.ScreenUpdating = True
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote