Place this function in a standard module: (Watch for line
wrapping)
Function ProperCase(strText As String)
Dim i As Integer, iSlen As Integer
Dim strCapAfter
strText = StrConv(strText, 3)
i = InStr(2, strText, "-")
If i <> 0 And i <> Len(strText) Then
Mid$(strText, i + 1, 1) = UCase$(Mid$(strText, i +
1, 1))
End If
strCapAfter = Array("mc", "m'", "o'")
For i = 0 To UBound(strCapAfter)
iSlen = Len(strCapAfter(i))
If StrComp(Left$(strText, iSlen), strCapAfter(i),
vbTextCompare) = 0 And iSlen < Len(strText) Then
Mid$(strText, iSlen + 1, 1) =
UCase$(Mid$(strText, iSlen + 1, 1))
i = UBound(strCapAfter)
End If
Next
ProperCase = strText
End Function
Call the function like this:
Controlname.Value = ProperCase(Controlname.Value)
This should deal with most of the problems including
macdonald etc
Dave
-----Original Message-----
I need to set a text box so that it will automatically
capitalize a name but I can't find it anywhere. DOes
anyone know the formula I would use to do that?