The following macro ensures all Footnote & Endnote references are placed after any applicable adjacent punctuation marks. Any preceding space characters are also deleted.
Code:
Sub FootnoteEndnoteFix()
Application.ScreenUpdating = False
Dim FtNt As Footnote, EndNt As Endnote, Rng As Range
With ActiveDocument
For Each FtNt In .Footnotes
Set Rng = FtNt.Reference
With Rng
'Eliminate any spaces before the footnote
While .Characters.First.Previous.Text = " "
.Characters.First.Previous.Text = vbNullString
Wend
'Swap the footnote/punctuation, as applicable
Select Case .Characters.Last.Next
Case ".", ",", "!", "?", ":", ";"
.InsertBefore .Characters.Last.Next
.Characters.Last.Next.Delete
End Select
End With
Next
For Each EndNt In .Endnotes
Set Rng = EndNt.Reference
With Rng
'Eliminate any spaces before the endnote
While .Characters.First.Previous.Text = " "
.Characters.First.Previous.Text = vbNullString
Wend
'Swap the endnote/punctuation, as applicable
Select Case .Characters.Last.Next
Case ".", ",", "!", "?", ":", ";"
.InsertBefore .Characters.Last.Next
.Characters.Last.Next.Delete
End Select
End With
Next
End With
Application.ScreenUpdating = True
End Sub