• Remove all Word Hyperlinks in 1 go? (XP)

    Author
    Topic
    #391160

    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.

    Viewing 1 reply thread
    Author
    Replies
    • #697576

      If you really want to remove the hyperlinks entirely, you can do the following:

      • Display field codes (Alt+F9)
      • Select Edit | Replace… (Ctrl+H)
      • Enter ^d HYPERLINK in the Find What box, and leave Replace With empty.
      • Click Replace All.
      • 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.

      • #1016023

        Doesn’t Ctrl + Shift + F9 do this?

        • #1016033

          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.

    • #697659

      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.

      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
      
      • #697726

        You could simplify this by using the Hyperlinks collection.

        Dim i as Integer

        For i = ActiveDocument.Hyperlinks.Count to 1 step -1
        ActiveDocument.Hyperlinks(i).Delete
        Next i

        StuartR

    Viewing 1 reply thread
    Reply To: Remove all Word Hyperlinks in 1 go? (XP)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: