|
|
CODE ' 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 Else fNameWithoutTitle = strTitlePlusName End If End Function
|
| This page was last modified 09:40, 6 April 2011. This page has been accessed 920 times. Disclaimers |