XLL+ Class Library (6.3)

CXlNewWorkbookEventStaticObserver::Update

Respond to an event

virtual void Update(
   CXlWorkbookEventArgs* e
);

Parameters

e

A pointer to an event arguments object is sent to the Update method.

Remarks

Derived classes should implement this function, which is the event handler for the XLL+ event model.

Example

The code below defines a class derived from CXlNewWorkbookEventStaticObserver, implements an Update method which is called when the event occurs, and instantiates an instance of the new class.

CopyC++
// Define a class derived from CXlNewWorkbookEventStaticObserver 
class CMyNewWorkbookEventObserver : CXlNewWorkbookEventStaticObserver
{
public:
    // This method will be called during the XlNewWorkbook event. 
    virtual void Update(CXlWorkbookEventArgs* e)
    {
        CXllApp::XlMessageBox(_T("Creating ") + e->GetBookName(), 
            XlMessageBoxTypeInformation);
    }
};

// Create an instance of the class
CMyNewWorkbookEventObserver myNewWorkbookObserver;

Requirements

Header: xlpevents.h

See Also

CXlNewWorkbookEventStaticObserver Class | CXlNewWorkbookEventStaticObserver Methods