View Single Post
 
Old 12-31-2020, 07:51 AM
gmaxey gmaxey is offline Windows 10 Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,598
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Sorry. I thought you were just trying to eliminate the hyperlink character style from the paragraph marks. To actually remove all hyperlinks contained in such paragraphs you could revise as:

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oRng As Range
Dim lngHL As Long
  Selection.Find.ClearFormatting
  Selection.Find.Replacement.ClearFormatting
  Set oRng = ActiveDocument.Range
  With oRng.Find
    .Text = "^p"
    .Style = "Hyperlink"
    While .Execute
      oRng.Select
      Selection.ClearCharacterAllFormatting
      For lngHL = oRng.Paragraphs(1).Range.Hyperlinks.Count To 1 Step -1
        oRng.Paragraphs(1).Range.Hyperlinks(lngHL).Delete
      Next lngHL
      oRng.Collapse wdCollapseEnd
    Wend
 End With
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote