View Single Post
 
Old 01-09-2022, 06:07 PM
macropod's Avatar
macropod macropod is offline Windows 10 Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,521
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

Try the following code. Although you refer to footnotes, your content is more akin to endnotes - which is what the macro converts your content to.
Code:
Sub CreateEndNotes()
Application.ScreenUpdating = False
Dim Tbl As Table, r As Long, Hlnk As Hyperlink
Dim RngRef As Range, RngText As Range
With ActiveDocument
  .Endnotes.NumberStyle = wdNoteNumberStyleArabic
  Set Tbl = .Hyperlinks(.Hyperlinks.Count).Range.Tables(1)
  If Tbl Is Nothing Then Exit Sub
  With Tbl
    For r = .Rows.Count To 1 Step -1
      If .Cell(r, 1).Range.Hyperlinks.Count > 0 Then
        Set Hlnk = .Cell(r, 1).Range.Hyperlinks(1)
        Set RngText = Tbl.Cell(r, 2).Range
        With RngText
          .End = .End - 1
          Do While .Characters.Last = vbCr
            .End = .End - 1
          Loop
        End With
        Set RngRef = ActiveDocument.Bookmarks(Hlnk.SubAddress).Range
        With RngRef
          .End = .Paragraphs(1).Range.End
          .End = .Hyperlinks(1).Range.End
          .Text = vbNullString
        End With
        ActiveDocument.Endnotes.Add RngRef
        With RngRef
          .End = .End + 1
          .Endnotes(1).Range.FormattedText = RngText.FormattedText
        End With
      End If
    Next
    .Delete
  End With
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote