initial capital PROPER Excel function converts all the words of the string passed as its argument in lower case with capitalized words ... is not very useful except for a list of names and surnames.
The function (UDF also) that I propose to convert a text extended to comply with certain rules of grammar. The text passed as an argument it is changed only in the beginning letters of words, letters, following a carriage return and in the letters that follow a period, exclamation point and a question mark. Following a routine to test the result. Would it be possible
do the trim first or conversion lcase ... but if you want, in fact, if you want you can do before passing the argument to the function. Greetings
r
MaiuscoInizialeMigliorato Function (
_ ByVal s As String) As String '
'__________________________________________
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
'by Robert Mensa nick r
'__________________________________________
' ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Dim v, i As Long
Dim re As Object
Set re = CreateObject("vbscript.regexp")
re.Pattern = _
"(^ _
"lowercase." & _ VbNewLine & _
"become the tiny capital"
& _ "if a sentence begins!" & _ VbNewLine & _
"become the tiny capital" & _
"after a point, point" & _
"exclamation or a question mark" & _ vbNewLine & _
"the become sensitive case "& _
" after a break. "
MsgBox s, vbOKOnly, "before"
MaiuscoInizialeMigliorato MsgBox (s),
_ vbOKOnly, "After" End Sub