XLL+ Class Library (7.0)

CXlWorkbookOpenEventStaticObserver::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 CXlWorkbookOpenEventStaticObserver, 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 CXlWorkbookOpenEventStaticObserver 
class CMyWorkbookOpenEventObserver : CXlWorkbookOpenEventStaticObserver
{
public:
    // This method will be called during the XlWorkbookOpen event. 
    virtual void Update(CXlWorkbookEventArgs* e)
    {
        CXllApp::XlMessageBox(_T("Opened ") + e->GetBookName(), 
            XlMessageBoxTypeInformation);
    }
};

// Create an instance of the class
CMyWorkbookOpenEventObserver myWorkbookOpenObserver;

Requirements

Header: xlpevents.h

See Also

CXlWorkbookOpenEventStaticObserver Class | CXlWorkbookOpenEventStaticObserver Methods