View Single Post
 
Old 04-05-2023, 12:15 AM
WJSwanepoel WJSwanepoel is offline Windows 10 Office 2021
Advanced Beginner
 
Join Date: Dec 2019
Location: Krugersdorp, South Africa
Posts: 82
WJSwanepoel is on a distinguished road
Default Partial Solution

I have it partially solved using this code:
Code:
Sub HLnk2FtNt()
Application.ScreenUpdating = False
Dim h As Long, Rng As Range
With ActiveDocument
  For h = .Hyperlinks.Count To 1 Step -1
    With .Hyperlinks(h)
         Set Rng = .Range
         With Rng
              .Collapse wdCollapseEnd
              .Footnotes.Add Rng
              .End = .End + 1
         End With
         bmName = .SubAddress
         Set hlRng = ActiveDocument.Bookmarks(bmName).Range
         ActiveDocument.Hyperlinks(h).Delete
         With hlRng
              .Expand wdParagraph
              .Start = .Start + 2
              .End = .End - 1
         End With
         Rng.Footnotes(1).Range.FormattedText = hlRng.FormattedText
    End With
  Next
End With
Application.ScreenUpdating = True
End Sub
There is one problem left. The piece of text that was the original Hyperlink still sits there. See attached file: PartialSolution.docx.

How can I remove that as well?
Attached Files
File Type: docx PartialSolution.docx (14.7 KB, 4 views)

Last edited by WJSwanepoel; 04-05-2023 at 12:16 AM. Reason: Fix Typo
Reply With Quote