Tuesday, December 24, 2024

VBA Word - Delete all hyperlinks from document

The following VBA code deletes all hyperlinks from document:
Sub DeleteHyperlinks()
    Dim doc As Document
    Dim hyp As Hyperlink
    Dim i As Integer
    Dim max As Integer
    
    max = ActiveDocument.Hyperlinks.Count
    On Error Resume Next
    For i = 1 To max
        ActiveDocument.Hyperlinks(i).Delete
    Next
End Sub

No comments:

Post a Comment

Hot Topics