'@Description("Returns True if candidate is a valid name for an Excel named reference, False if not, and an error if the check fails")
Public Function NameIsValid(name As String) As Variant
NameIsValid = False
'...
If IsError(eval) Then
' Granularly distinguish between specific errors.
If ( _
eval = CVErr(xlErrName) Or _
eval = CVErr(xlErrValue) _
) Then
NameIsValid = False
Else
NameIsValid = eval 'return the unknown error
End If
Else
NameIsValid = True
End If
End Function
Note False is not the default value of a variant function so must be specified explicitly.