Last modified: March 18, 2009

Applies to: Excel 2010 | Office 2010 | VBA | Visual Studio

Called by Microsoft Excel whenever the user deactivates the XLL during an Excel session by using the Add-In Manager. This function is not called when an Excel session closes, normally or abnormally, with the add-in installed.

This function can be used to display a custom dialog box telling the user that the add-in has been deactivated, or to read from or write to the registry, for example.

Excel does not require an XLL to implement and export this function.

int WINAPI xlAutoRemove(void);

This function takes no arguments.

Your implementation of this function must return 1 (int).

Use this function if your XLL needs to complete any task when it is removed by the Add-In Manager.

See the files \SAMPLES\EXAMPLE\EXAMPLE.C and \SAMPLES\GENERIC\GENERIC.C for example implementations of this function. The following code is from \SAMPLES\EXAMPLE\EXAMPLE.C.

int WINAPI xlAutoRemove(void)
/* Display a dialog box indicating that the XLL was successfully removed */
   Excel12f(xlcAlert, 0, 2,
      TempStr12(L"Thank you for removing Example.XLL!"),
   return 1;