UtterAccess HomeUtterAccess Wiki

Welcome Guest ( Log In | Register )

Custom Search
Edit Discussion
> RemoveSalutationFromFullName    
' Code courtesy of UtterAccess Wiki
' http://www.utteraccess.com/wiki/index.php/Category:FunctionLibrary
' Original submission by Alan Greenwood
' Date contributed 16th August 2010
' You are free to use it in any application,
' provided this copyright notice is left unchanged.

Public Function fNameWithoutTitle(strTitlePlusName As String) As String
'Purpose: To remove the salutation from a passed full name.
'Example usage: fNameWithoutTitle("Mr Joe Bloggs") will return Joe Bloggs

   Dim strTitle As String

   If InStr(strTitlePlusName, " ") > 0 Then

       strTitle = left(strTitlePlusName, InStr(strTitlePlusName, " ") - 1)

       Select Case strTitle
       Case "Mr", "Mr.", "Ms", "Ms.", "Mrs", "Mrs.", "Miss", "Miss.", "Dr", "Dr.", "Rev", "Rev."     'add additional titles
           fNameWithoutTitle = Mid(strTitlePlusName, InStr(strTitlePlusName, " ") + 1)
       Case Else        'do nothing
           fNameWithoutTitle = strTitlePlusName
       End Select


       fNameWithoutTitle = strTitlePlusName

   End If

End Function

Creative Commons License
RemoveSalutationFromFullName by UtterAccess Wiki is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Editing and revision of the content is freely encouraged; for details, see Expected Usage.

Edit Discussion
Custom Search

Thank you for your support!
This page has been accessed 4,930 times.  This page was last modified 09:40, 6 April 2011 by Jack Leach. Contributions by Alan Greenwood  Disclaimers