Using <Edit><Find> to find and replace hyperlinks

  • Thread starter Thread starter Guybo
  • Start date Start date
G

Guybo

I have a large document with many hyperlinks. I would like to replace all of
the hyperlinks in that document and keep the text. I cannot find a way to do
this using <Edit><Find>. Is there a way? If not, is there any other way?

I am using Microsoft Office Word 2003 fully patched and undated.
 
This workks fine for removing the hyperlinks, but it does not leave the
text.

How can I delete the hyperlink and leave the text?

Guy
 
The two macros below will unlink Hyperlinks (which leaves the text) or
delete them which doesn't.

Sub UnlinkHyperlinks()
Dim oField As Field
For Each oField In ActiveDocument.Fields
If oField.Type = wdFieldHyperlink Then
oField.Unlink
End If
Next
Set oField = Nothing
End Sub

Sub DeleteHyperlinks()
Dim oHlink As Hyperlink, i As Long
For i = ActiveDocument.Hyperlinks.Count To 1 Step -1
ActiveDocument.Hyperlinks(i).Delete
Next i
End Sub

http://www.gmayor.com/installing_macro.htm


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
I didn't specify what to do when you find the hyperlink! If you are
replacing it with nothing or deleting it, then yes, it's gone. But you can
equally well do this:

1. Find the first hyperlink.

2. Close the Find dialog.

3. With the hyperlink selected, press Ctrl+Shift+F9 to unlink it.

4. Use the Find Next browse arrow at the bottom of the vertical scroll bar
to find the next hyperlink.

5. Press F4 to unlink it.

6. Repeat steps 4 and 5 until you don't find any more.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
http://word.mvps.org
 
Select all
Ctrl+Shift+F9



Guybo said:
This workks fine for removing the hyperlinks, but it does not leave the
text.

How can I delete the hyperlink and leave the text?

Guy
 
Ctrl+Shft+F9 (Unlink Fields) is fine if you only have unwanted Hyperlinks in
your document, but unlinking all other fields may not be what is wanted.
Even a humble TOC will become text and will lose its GoToHeading and update
functions.
 
Back
Top