The Forum has been Updated
The code has been upgraded to the latest .NET core version. Please check instructions in the Community Announcements about migrating your account.
So I scrounged this function up many, many years ago and it works great....
Code:
Function TitleCase(stValue)
iPos = 1
Do While InStr(iPos, stValue, " ", 1) <> 0
iSpace = InStr(iPos, stValue, " ", 1)
sTemp = sTemp & UCase(Mid(stValue, iPos, 1))
sTemp = sTemp & LCase(Mid(stValue, iPos + 1, iSpace - iPos))
iPos = iSpace + 1
Loop
sTemp = sTemp & UCase(Mid(stValue, iPos, 1))
sTemp = sTemp & LCase(Mid(stValue, iPos + 1))
TitleCase = sTemp
End Function
This capitalizes every letter after a space.
I would like it to also capitalize letters after a dash. I played with it for several hours yesterday but obviously functions are not my strong suit.