Hi,
There's one more error code which I think was introduced in Excel
2010, called xlerrGettingData (in Excel-DNA it's
ExcelError.ExcelErrorGettingData).
This is displayed as #GETTING_DATA on the sheet. I can't find any
documentation for it, but suspect it interacts in some way with the
native async feature, though not in an obvious way. It might be a
useful return value for the Excel-DNA async and observable functions
to return on supported Excel versions, but I've stuck to #N/A as the
default for compatibility with old Excel versions and RTD.
Otherwise Excel offers no way to add your own error codes or enhance
the error information you return.
-Govert
On May 22, 8:10 pm, Faraz Ahmed Qureshi <
farazem...@gmail.com> wrote:
> Is there any special way to return an error other than the usual #VALUE!
> error? Consider the following sample UDF returning only #VALUE! error in
> all Cases except where value of Opt is not between 1 to 7:
>
> Public XL As Object = ExcelDnaUtil.Application
> <ExcelFunction(DESCRIPTION:="Function to return appropriate Excel
> Errors.", CATEGORY:="Test Functions", ISVOLATILE:=True, ISMACROTYPE:=True)>
> Public Function TestErrorReturns(Opt As Object)
> Select Case Opt
> Case 1
> TestErrorReturns = XL.CVErr(XL.xlErrNA)
> Case 2
> TestErrorReturns = XL.CVErr(XL.xlErrDiv0)
> Case 3
> TestErrorReturns = XL.CVErr(XL.xlErrName)
> Case 4
> TestErrorReturns = XL.CVErr(XL.xlErrNull)
> Case 5
> TestErrorReturns = XL.CVErr(XL.xlErrNum)
> Case 6
> TestErrorReturns = XL.CVErr(XL.xlErrRef)
> Case 7
> TestErrorReturns = XL.CVErr(XL.xlErrValue)
> Case Else
> TestErrorReturns = "No Error"
> End Select
> End Function