The following macro will restore your endnotes. All you need do is select all the endnotes presently at the end of the document before running the macro. The macro can handle endnotes containing multiple paragraphs, but not Word tables - those you'll need to move elsewhere, then reinsert after running the macro.
I strongly recommend you ensure all tracked changes affecting endnote numberings are accepted before running the macro and that change tracking is disabled before running it.
As coded, the macro assumes your endnotes have arabic numbering (i.e. 0-9999). If they use roman numerals, comment-out or delete the line:
.Text = "^13([!0-9])"
and activate the line:
.Text = "^13([!ivxlcd])"
Strictly speaking, this modification is only necessary if any of your endnotes has more than one paragraph.
For PC macro installation & usage instructions, see: http://www.gmayor.com/installing\_macro.htm
For Mac macro installation & usage instructions, see: https://wordmvp.com/Mac/InstallMacro.html
Sub ReLinkEndNotes()
Application.ScreenUpdating = False
Dim i As Long, EndNt As Endnote, StrFnd As String
Dim FndRng As Range, DocRng As Range, NtRng As Range
With ActiveDocument
Set FndRng = Selection.Range
Set DocRng = .Range
DocRng.End = FndRng.Start
With FndRng
.Style = "Endnote Text"
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Forward = True
.Format = False
.Wrap = wdFindStop
.MatchWildcards = True
.Text = "^13([!0-9])"
'.Text = "^13([!ivxlcd])"
.Replacement.Text = "¶\1"
.Execute Replace:=wdReplaceAll
End With
For i = .Paragraphs.Count To 1 Step -1
With .Paragraphs(i).Range
StrFnd = Trim(.Words(1))
StatusBar = "Creating Endnote: " & StrFnd
.Start = .Start + Len(StrFnd)
.End = .End - 1
Set NtRng = .Duplicate
End With
With DocRng
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Font.Superscript = True
.MatchWildcards = True
.Forward = False
.Format = True
.Text = StrFnd
End With
If .Find.Execute = True Then
.Text = vbNullString
Set EndNt = .Endnotes.Add(Range:=.Duplicate)
EndNt.Range.FormattedText = NtRng.FormattedText
.Collapse wdCollapseStart
End If
End With
Next i
.Delete
End With
With .StoryRanges(wdEndnotesStory).Find
.ClearFormatting
.Replacement.ClearFormatting
.Forward = True
.Format = False
.Wrap = wdFindStop
.Text = "¶"
.Replacement.Text = "^p"
.Execute Replace:=wdReplaceAll
End With
End With
Set FndRng = Nothing: Set DocRng = Nothing: Set NtRng = Nothing
Application.ScreenUpdating = True
End Sub