Capitalization code - 50 pts

Does anyone have code that will capitalize the first letter of each word in a string?  Thanks!
neymeyerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

VbmasterCommented:
It ought to look something like this


Function Capitalize(ByVal Value As String) As String

  Dim a As Long
  Dim LenValue As Long

  LenValue = Len(Value)

  Mid$(Value, 1, 1) = UCase$(Mid$(Value, 1, 1))
  For a = 1 To LenValue
    Select Case Mid$(Value, a, 1)
    Case " "
      If (a < LenValue) Then
        Mid$(Value, a + 1, 1) = UCase$(Mid$(Value, a + 1, 1))
      End If
    End Select
  Next
  Capitalize = Value

End Function


You can add more characters at the end of the Case line if you'd like, this function will upper-case the character after every space + the very first character in the string.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
neymeyerAuthor Commented:
Awesome, Thanks a lot!
0
tureCommented:
neymeyer,

Here's another suggestion:

Function PCase(x As String) As String
  Dim p As Long
  PCase = Trim(LCase(x))
  Do
    Mid(PCase, p + 1, 1) = UCase(Mid(PCase, p + 1, 1))
    p = InStr(p + 1, PCase, " ")
  Loop Until p = 0
End Function

Ture Magnusson
Karlstad, Sweden
0
johnczimmCommented:
Have you tried StrConv?

StrConv(Text1.Text, vbProperCase)

JOHN
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.