So you're not even referring to the footnotes, but to their references in the body of the document? In that case, try:
Sub FootnoteEndnoteFix()
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
If .Characters.Last.Next Like "[.,!?:;]" Then
.InsertBefore .Characters.Last.Next
.Characters.Last.Next.Delete
End If
End With
Next
End With
End Sub
Just for variety, I've use a Select Case test for footnotes and an If Like test for endnotes!