Called by the framework when the XLL is unloaded from memory
virtual int ExitInstance( ); |
0 if the function completes successfully; non-zero otherwise.
This method is called whenever the XLL is finally unloaded from memory. Note that this can occur not only when Excel is closed, but also whenever the XLL is examined in Excel's Tools/AddIns dialog.
Final termination tasks can be done here. If the method is used, then it must call the base class method CXllApp::ExitInstance().
In general it is better to place all termination code in CXllApp::OnXllClose.
In the MFC builds, CXllApp is descended from CWinApp. Calling the base class ExitInstance ensures that the MFC implementation is properly cleaned up.
Header: xllplus.h
CXllApp Class | CXllApp Methods | CXllApp::InitInstance() | CXllApp::OnXllClose()