Respond to an event
virtual void Update( CXlAfterSaveEventArgs* e ); |
A pointer to an event arguments object is sent to the Update method.
Derived classes should implement this function, which is the event handler for the XLL+ event model.
Note that this event is only available when running under Excel 2010 (Excel 14) or above.
The code below defines a class derived from CXlWorkbookAfterSaveEventStaticObserver, implements an Update method which is called when the event occurs, and instantiates an instance of the new class.
// Define a class derived from CXlWorkbookAfterSaveEventStaticObserver class CMyWorkbookSaveEventObserver : CXlWorkbookAfterSaveEventStaticObserver { public: // This method will be called during the XlWorkbookAfterSave event. virtual void Update(CXlAfterSaveEventArgs* e) { CXllApp::XlMessageBox(_T("Saved ") + e->GetBookName(), XlMessageBoxTypeInformation); } }; // Create an instance of the class CMyWorkbookSaveEventObserver myWorkbookSaveObserver;
Header: xlpevents.h
CXlWorkbookAfterSaveEventStaticObserver Class | CXlWorkbookAfterSaveEventStaticObserver Methods