This function I wrote a few years ago converts all characters in a string to UCase, but ignores characters already in UCase, so can handle say:
Function RealProper(varString As Variant) As Variant
Dim i As Integer
Dim strString As String
Dim strCurrChar As String, strPrevChar As String
If IsNull(varString) Then
Exit Function
End If
strString = CStr(varString)
For i = 1 To Len(strString)
strCurrChar = Mid$(strString, i, 1)
Select Case strPrevChar
Case "A" To "Z" 'ignore characters that are already UCase
Case "a" To "z"
Mid(strString, i, 1) = LCase(strCurrChar)
Case Else
Mid(strString, i, 1) = UCase(strCurrChar)
End Select
strPrevChar = strCurrChar
Next i
RealProper = CVar(strString)
End Function
msgbox RealProper("the AA is better than the RAC says mr mcDonald!)
This would return: "The AA Is Better Than The RAC Says Mr McDonald!"
vbProperCase would return "The Aa Is Better Than The Rac Says Mr Mcdonald!"
Happy xmas to you all.