PROPER function

My other only guess is that the String does not even have a Comma in it.. So lets do this..
Code:
Public Function properName(inputStr As String) As String
[COLOR=Green]'**********************
'Code Courtesy of
'  Paul Eugin
'**********************[/COLOR]
[COLOR=Blue]On Error GoTo errHandler[/COLOR]
    Dim tmpStr As String
    If InStr(inputStr, ",") <> 0 Then
        tmpStr = Mid(inputStr, InStr(inputStr, ",") + 1)
        tmpStr = tmpStr & " " & Mid(inputStr, 1, InStr(inputStr, ",") - 1)
    Else
        tmpStr = inputStr
    End If
    properName = Trim(StrConv(tmpStr, vbProperCase))
[COLOR=Blue]exitFunc:[/COLOR]
[COLOR=Blue]    Exit Function[/COLOR]
[COLOR=Blue]errHandler:
    properName = vbNullString
    Resume exitFunc[/COLOR]
End Function
 
THANKS Paul,

Is not a surprise to you that the code is working, I had a better look into the raw data and is amazing as not only can see #MULTIVALUE, ?, Blanks, names with space after the comma, or no space, there isn't any logic behind this, however it seems that your code is bypassing this now, so again THANK YOU.

MERRY CHRISTMAS
:)
 
Well I have forced the function to return a Null String if in case it encounters an Error, you could however change it as you wish either to set a default String like "Invalid Entry" or "Not Recognized " or something like that.

However it work (kinda sorta) ! Good luck !

A very Merry Christmas to you too ! :)
 

Users who are viewing this thread

Back
Top Bottom