Results 1 to 6 of 6
  1. #1
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    England
    Posts
    569
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Remove all Word Hyperlinks in 1 go? (XP)

    Hi,

    My Word Doc has many hyperlinks.
    I want to keep the doc exactly as it is, but remove all the hyperlinks in 1 go.

    Does anyone know a clever way to do this?

    m.q.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Remove all Word Hyperlinks in 1 go? (XP)

    If you really want to remove the hyperlinks entirely, you can do the following:
    <UL><LI>Display field codes (Alt+F9)
    <LI>Select Edit | Replace... (Ctrl+H)
    <LI>Enter ^d HYPERLINK in the Find What box, and leave Replace With empty.
    <LI>Click Replace All.
    <LI>Hide field codes (Alt+F9)[/list]If this is a one-off, the above is simple enough; if you have to do it repeatedly, it could be made into a macro.

    If you want to keep the text, but remove its "clickability", you need a macro to do it in one go, as far as I know.

  3. #3
    Star Lounger
    Join Date
    Jan 2001
    Location
    U.S. - East Coast
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Remove all Word Hyperlinks in 1 go? (XP)

    Here's a macro to remove all the hyperlinks in the ActiveDocument. Note: this only removes the hyperlink, not the display text. Also, the style for the hyperlinked text will likely revert from "Hyperlink" to style of the surrounding text.

    <pre>Sub DisableHyperlinks()

    Dim fldHyperlink As Field
    Dim blnDisplayFieldCodes As Boolean

    With ActiveDocument

    'Display field codes (after caching current setting).
    With .ActiveWindow.View
    blnDisplayFieldCodes = .ShowFieldCodes
    .ShowFieldCodes = True
    End With

    'Iterate through all fields...
    For Each fldHyperlink In .Fields

    If fldHyperlink.Type = wdFieldHyperlink Then
    'Hyperlink field, so remove link (Note: display text remains)
    fldHyperlink.Select
    Selection.Range.Hyperlinks(1).Delete
    End If

    Next fldHyperlink

    'Restore field codes display setting.
    .ActiveWindow.View.ShowFieldCodes = blnDisplayFieldCodes

    End With

    End Sub
    </pre>


  4. #4
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Remove all Word Hyperlinks in 1 go? (XP)

    You could simplify this by using the Hyperlinks collection.
    <font face="Georgia">
    Dim i as Integer

    For i = ActiveDocument.Hyperlinks.Count to 1 step -1
    ActiveDocument.Hyperlinks(i).Delete
    Next i
    </font face=georgia>

    StuartR

  5. #5
    Super Moderator WebGenii's Avatar
    Join Date
    Jan 2001
    Location
    Redcliff, Alberta, Canada
    Posts
    4,066
    Thanks
    2
    Thanked 5 Times in 5 Posts

    Re: Remove all Word Hyperlinks in 1 go? (XP)

    Doesn't Ctrl + Shift + F9 do this?
    [b]Catharine Richardson (WebGenii)
    WebGenii Home Page
    Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Remove all Word Hyperlinks in 1 go? (XP)

    If the only fields in the document are hyperlink fields, that'd work fine, but if there are other kinds of fields, they would be removed too, which might not be desirable.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •