View Single Post
 
Old 04-02-2025, 10:28 PM
macropod's Avatar
macropod macropod is offline Windows 10 Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Your
Code:
Selection.WholeStory
Selection.Fields.Unlink
gives the same result as
Code:
ActiveDocument.Fields.Unlink
The differences are that the latter code doesn't employ the inefficient selection method or change your current selection.

If you only want to unlink superscripted hyperlinks, you could use:
Code:
Sub DemoC()
Application.ScreenUpdating = False
Dim h As Long
With ActiveDocument.Range
  For h = .Hyperlinks.Count To 1 Step -1
    With .Hyperlinks(h).Range
      If .Font.Superscript = True Then .Fields(1).Unlink
    End With
  Next
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Font.Superscript = True
    .Execute FindText:="[\(\[]*[\)\]]", ReplaceWith:="", MatchWildcards:=True, Format:=False, Forward:=True, Wrap:=wdFindContinue, Replace:=wdReplaceAll
  End With
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote