12.27.2020

Remove Hyperlinks in Word

The Macro:


Option Explicit Sub KillTheHyperlinks() ' ----------------------------------------------- ' Removes all hyperlinks from the document: ' Text to display is left intact ' ----------------------------------------------- With ThisDocument ' Loop while there are hyperlinks afoot! While .Hyperlinks.Count > 0 .Hyperlinks(1).Delete Wend End With ' Shut this off, don't need anymore popping up Application.Options.AutoFormatAsYouTypeReplaceHyperlinks = False End Sub Sub KillTheHyperlinksInAllOpenDocuments() ' ----------------------------------------------- ' Removes all hyperlinks from any open documents ' Text to display is left intact ' ----------------------------------------------- Dim doc As Document Dim szOpenDocName As String ' Loop through all open documents: For Each doc In Application.Documents ' Store the document name szOpenDocName = doc.Name ' Remove the hyperlinks from that document With Documents(szOpenDocName) ' Loop while there are hyperlinks afoot! While .Hyperlinks.Count > 0 .Hyperlinks(1).Delete Wend End With ' Shut this off, don't need anymore popping up Application.Options.AutoFormatAsYouTypeReplaceHyperlinks = False Next doc End Sub