Framework library function. This function creates a temporary error XLOPER.
Returns an error LPXLO0PER (xltypeErr) containing the error code passed in.
TempErr(WORD err);
err (WORD)
The error code to place in the integer OPER. The error codes, which are defined in XLCALL.H, are shown in the following table.
| Error | Error value | Decimal equivalent | |
| #NULL | xlerrNull | 0 | |
| #DIV/0! | xlerrDiv0 | 7 | |
| #VALUE! | xlerrValue | 15 | |
| #REF! | xlerrRef | 23 | |
| #NAME? | xlerrName | 29 | |
| #NUM! | xlerrNum | 36 | |
| #N/A | xlerrNA | 42 | |
This example uses the TempErr function to return a #VALUE! error to Microsoft Excel.
\SAMPLES\EXAMPLE\EXAMPLE.C
LPXLOPER WINAPI TempErrExample(void)
{
    return TempErr(xlerrValue);
}