- Home
·
- String Manipulation
·
- This function will extract the initials of someone's name. It is good to use for a primary key, in
This function will extract the initials of someone's name. It is good to use for a primary key, in
This function will extract the initials of someone's name. It is good to use for a primary key, in an access or sql DB
Rate This function will extract the initials of someone's name. It is good to use for a primary key, in
(1(1 Vote))
Dim OutString As String, CurrentLetter As String, Scap As String, ourstring As String
Dim CurrentWord As String, TCaps As String
Dim StrCount As Integer, I As Byte
OutString = ""
If InString = "" Then
ExtractInitials = ""
Exit Function
End If
CurrentWord = ""
For StrCount = 1 To Len(InString)
CurrentLetter = Mid(InString, StrCount, 1)
CurrentWord = CurrentWord + CurrentLetter
If InStr(" .,/\;:-!?[]()#", CurrentLetter) <> 0 Or _
StrCount = Len(InString) Then
TCaps = UCase(Left(CurrentWord, 1))
For I = 2 To Len(CurrentWord)
TCaps = TCaps & Mid(CurrentWord, I, 1)
Scap = Left(TCaps, 1)
Next
'OutString = OutString & TCaps
ourstring = ourstring & Scap
CurrentWord = ""
End If
Next
If Len(ourstring) > 3 Then
MsgBox "The name cannot be greater then 3 initials, please correct"
Exit Function
End If
ExtractInitials = ourstring
End Function
This function will extract the initials of someone's name. It is good to use for a primary key, in Comments
No comments yet — be the first to post one!
Post a Comment