VB Code:
Function StrToSentenceCase(ByVal txt As String)
Dim txts As String, txtChr As String
Dim X As Long, Y As Long
'Check the first 10 characters to get
'the first - incase the selection includes
'some spaces at the beginning.
For X = 1 To 10
txtChr = Mid$(txt, X, 1)
If txtChr Like "[a-zA-Z]" Then
Mid$(txt, X, 1) = UCase(txtChr)
Exit For
End If
Next X
'Check each character to find the criteria (.!?)
'for the end of a sentence, then Capitalize the next letter.
For X = X To Len(txt)
txtChr = Mid$(txt, X, 1)
If txtChr Like "[.!?]" Then
For Y = X + 1 To X + 10
txtChr = Mid$(txt, Y, 1)
If txtChr Like "[a-zA-Z]" Then
Mid$(txt, Y, 1) = UCase(txtChr)
X = Y + 1
Exit For
End If
Next Y
End If
Next X
StrToSentenceCase = txt
End Function