Applies to: Excel 2013 | Office 2013 | Visual Studio

Used to create and delete defined names associated with the DLL.

Excel12(xlfSetName, LPXLOPER12 pxRes, 2, LPXLOPER12 pxNameText, LPXLOPER12 pxNameDefinition);


pxNameText (xltypeStr)

The name of the range, which should conform to the usual limitations in Microsoft Excel on valid names.

pxNameDefinition (xltypeStr, xltypeNum, xltypeBool, xltypeErr, xltypeMulti, xltypeSRef, xltypeRef, or xltypeInt)

(Optional). The value, set of values, cell, or range of cells that pxNameText is defined as. If omitted, the name is deleted.

Property value/Return value

pxRes (xltypeBool or xltypeErr)

TRUE if the operation succeeded or FALSE if the name could not be created or deleted. Returns #VALUE! if one or more of the arguments was invalid.


When a function or command is registered using xlfRegister with a valid pxFunctionText argument, Excel creates a name associated with the DLL resource. When your DLL is being unloaded, such names should be deleted using the xlfSetName function. However, due to a known issue in Excel, this deletion operation fails. For more information, see Known Issues in Excel XLL Development.


See the code for the xlAutoClose function in \SAMPLES\GENERIC\GENERIC.C.

See also