xlfUnregister (Form 2)

Office 2013 and later

Last modified: July 01, 2011

Applies to: Excel 2013 | Office 2013 | Visual Studio

Can be called from a DLL or XLL command that has itself been called by Microsoft Excel. This is equivalent to calling UNREGISTER from an Excel XLM macro sheet.

xlfUnregister can be called in two forms:

  • Form 1: Unregisters an individual command or function.

  • Form 2: Unloads and deactivates an XLL.

Called in Form 2, this function forces a DLL or code resource to be unloaded completely. It unregisters all of the functions in a DLL, even if they are currently in use by another macro, no matter what the use count. This function calls xlAutoClose, and then unregisters all the functions in the DLL.

Excel12(xlfUnregister, LPXLOPER12 pxRes, 1, LPXLOPER12 pxModuleText);

pxModuleText (xltypeStr)

The name of the DLL.

If successful, returns TRUE (xltypeBool). If unsuccessful, returns FALSE.

Note: Do not call this form of the function from your implementation of the xlAutoClose in an attempt to unregister all of the DLL's resources with one simple function call. This leads to recursive calling of xlAutoClose and a stack overflow.

Remember to Delete Names

If you specified the pxFunctionText argument to xlfRegister, when registering the DLL's functions and commands, you must explicitly delete the names by calling xlfSetName for each one, omitting the second argument so that the function no longer appears in the Function Wizard. For more information, see Known Issues in Excel XLL Development.