ReverseFullName - Convert a full name into the "LastName, FirstName" format

' reverse a full name'' for example: ReverseFullName("John A. Smith") ==> "Smith, John A."
Function ReverseFullName(ByVal FullName As String) As String
Dim i As Long
' search for the last space
FullName = Trim$(FullName)
i = InStrRev(FullName, " ")
If i = 0 Then
' no space, just return the argument
ReverseFullName = FullName
Else
ReverseFullName = Mid$(FullName, i + 1) & ", " & Left$(FullName, i - 1)
End If
End Function