TempErr/TempErr12

Applies to: Excel 2013 | Office 2013 | Visual Studio

Framework library function that creates a temporary XLOPER/ XLOPER12 containing a Microsoft Excel worksheet error.

LPXLOPER TempErr(WORD err);
LPXLOPER12 TempErr12(BOOL err);

Parameters

err

The desired error code, or its literal numeric equivalent, as shown in the following table.

Error Error code defined in XLCALL.H 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

Return value

Returns an xltypeBool containing the error code passed in.

Example

This example uses the TempErr12 function to return a #VALUE! error to Excel.

Note

The Framework library function TempErr12 allocates memory from an internal buffer, which is normally freed when the Framework function Excel12f is called. If this example function is called repeatedly without Excel12f being called, a memory leak occurs.

\SAMPLES\EXAMPLE\EXAMPLE.C

LPXLOPER WINAPI TempErrExample(void)
{
    return TempErr12(xlerrValue);
}

See also

Functions in the Framework Library