XLL+ Class Library

CXllApp::OnNewWorkbook

Called by the framework when Excel creates a new workbook

[C++]
virtual void OnNewWorkbook(
   LPDISPATCH dispWorkbook
);

Parameters

dispWorkbook

Pointer to dispatch interface of class Excel.Workbook.

Remarks

This function is called whenever Excel creates a new workbook.

Note that it will only be called if event-sinking is switched on (using CXllApp::SetSinkEvents()).

You can override the method in your application class to react to the event. The default method checks for a function which has been registered as a callback for this event using CXllApp::SetComEventHandler(), and calls it if it is present.

Implementation note

You should only implement this function if you need access to Excel's COM interfaces. If you just want to call an add-in function, use the much simpler mechanism provided by CXllApp::SetComEventHandler().

Requirements

Header: xllplus.h

See Also

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