Hi dorogoi,
Why do you suggest that I should apply footnote style to references that were footnotes?
Answer:
to differentiate each type of note from each other
Likewise for the reference marks, which use the 'EndNote Reference' and 'FootNote Reference' Styles, respectively. Format those Styles appropriately (they're superscripted by default) and there's no need to mess around with colouring on a per-reference basis.
Accordingly, your code could be:
Sub UnLinkNotes()
'Code by macropod @ http://www.vbaexpress.com/forum/showthread.php?t=31231
Application.ScreenUpdating = False
Dim nRng As Range, eNote As Endnote, fNote As Footnote, nRef As String
With ActiveDocument
.Styles("Footnote Reference").Font.Color = wdColorGreen
For Each fNote In .Footnotes
With fNote
With .Reference.Characters.First
.Collapse
.InsertCrossReference wdRefTypeFootnote, wdFootnoteNumberFormatted, fNote.Index
nRef = .Characters.First.Fields(1).Result
.Characters.First.Fields(1).Unlink
End With
.Range.Cut
End With
Set nRng = .Range
With nRng
.InsertAfter vbCr & nRef & " "
.Paragraphs.Last.Range.Style = "Footnote Text"
.Paragraphs.Last.Range.Words.First.Style = "Footnote Reference"
.Start = .End
.Paste
End With
Next
For Each fNote In .Footnotes
fNote.Delete
Next
.Styles("Endnote Reference").Font.Color = wdColorRed
For Each eNote In .Endnotes
With eNote
With .Reference.Characters.First
.Collapse
.InsertCrossReference wdRefTypeEndnote, wdEndnoteNumberFormatted, eNote.Index
nRef = .Characters.First.Fields(1).Result
.Characters.First.Fields(1).Unlink
End With
.Range.Cut
End With
Set nRng = .Range
With nRng
.InsertAfter vbCr & nRef & " "
.Paragraphs.Last.Range.Style = "Endnote Text"
.Paragraphs.Last.Range.Words.First.Style = "Endnote Reference"
.Start = .End
.Paste
End With
Next
For Each eNote In .Endnotes
eNote.Delete
Next
End With
Set nRng = Nothing
Application.ScreenUpdating = True
End Sub