XLL+ Class Library

CXllApp::SetSinkEvents

Sets the SinkEvents flag to switch COM event handling on or off

[C++]
BOOL SetSinkEvents(
   BOOL bSinkEvents
);

Parameters

bSinkEvents

The new value of the SinkEvents flag

Return value

Returns the new value of the SinkEvents flag.

Remarks

This function sets the state of the COM event handler.

If it is set to TRUE, then the event handlers for COM events will be invoked whenever significant events occur in Excel.

You can specify event handlers by overloading the appropriate virtual function in your derived application class.

COM event handlers

The functions registered using CXllApp::SetComEventHandler() will not be called unless SetSinkEvents(TRUE) has been called.

In addition, the following handlers are switched on and off by SetSinkEvents():

CXllApp::OnNewWorkbook()
CXllApp::OnSheetSelectionChange()
CXllApp::OnSheetBeforeDoubleClick()
CXllApp::OnSheetBeforeRightClick()
CXllApp::OnSheetActivate()
CXllApp::OnSheetDeactivate()
CXllApp::OnSheetCalculate()
CXllApp::OnSheetChange()
CXllApp::OnWorkbookOpen()
CXllApp::OnWorkbookActivate()
CXllApp::OnWorkbookDeactivate()
CXllApp::OnWorkbookBeforeClose()
CXllApp::OnWorkbookBeforeSave()

Note that the other overridable functions (OnXllOpen() etc) are not affected by the SinkEvents flag.

Requirements

Header: xllplus.h

See Also

CXllApp Class | CXllApp Methods | CXllApp::GetSinkEvents()