Thread: [Solved] Find and Replace
View Single Post
 
Old 07-24-2011, 05:27 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi xavier,

The first F/R won't work because many (if not all) of the 'email' addresses in your document are formatted as hyperlinks (even though someone has formatted them to look like plain text). You can convert the hyperlinks back to plain text via Ctr-A, then Ctrl-Shift-F9. However, you then will have to do the cleanup work that we discussed in your other thread, because unlinking the hyperlinks will cause the email addresses that lack spaces after them to become joined to the following text. A better way of handling the email addresses would be to use a macro like:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim Fld As Field
For Each Fld In ActiveDocument.Fields
  If Fld.Type = wdFieldHyperlink Then
    With Fld.Result
      .Style = "Hyperlink"
      If .Characters.Last.Next <> " " Then .Characters.Last.Next.InsertBefore "  "
      If .Characters.Last.Next.Next <> " " Then .Characters.Last.Next.InsertBefore " "
      If .Characters.First.Previous <> " " Then .InsertBefore "  "
      If .Characters.First.Previous.Previous <> " " Then .InsertBefore " "
    End With
  End If
Next
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote