by Scott Rubin (1 Submission)
Category: String Manipulation
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Sun 12th September 1999
Date Added: Mon 8th February 2021
Rating:
(1 Votes)
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
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
No comments have been posted about This function will extract the initials of someone's name. It is good to use for a primary key, in . Why not be the first to post a comment about This function will extract the initials of someone's name. It is good to use for a primary key, in .