Function CorrectNames(ByVal strName As String) As String
On Error GoTo Err_CorrectNames
Dim intCounter As Integer
strName = StrConv(strName, vbProperCase)
If InStr(1, strName, "Mc") Then _
strName = Left(strName, InStr(1, strName, "Mc") - 1) & "Mc" & _
StrConv(Mid(strName, InStr(1, strName, "Mc") + 2), vbProperCase)
If InStr(1, strName, "Mac") Then _
strName = Left(strName, InStr(1, strName, "Mac") - 1) & "Mac" & _
StrConv(Mid(strName, InStr(1, strName, "Mac") + 3), vbProperCase)
If InStr(1, strName, "'") Then
If InStr(1, strName, "O'") Then
strName = Left(strName, InStr(1, strName, "O'") - 1) & "O'" & _
StrConv(Mid(strName, InStr(1, strName, "O'") + 2), vbProperCase)
Else
strName = Left(strName, InStr(1, strName, "'") - 2) & LCase(Mid(strName, InStr(1, strName, "'") - 1, 1)) & "`" & _
StrConv(Mid(strName, InStr(1, strName, "'") + 1), vbProperCase)
End If
End If
CorrectNames = strName
Exit_CorrectNames:
Exit Function
Err_CorrectNames:
MsgBox Err.Description, vbExclamation, "Error #" & Err.Number
Resume Exit_CorrectNames
End Function