XLL+ Class Library (6.3)

CXllApp::OnWorkbookBeforeSave

Called by the framework just before a workbook is saved

virtual BOOL OnWorkbookBeforeSave(
   LPDISPATCH dispWorkbook,
   BOOL bSaveAsUI
);

Parameters

dispWorkbook

Pointer to dispatch interface of type Excel.Workbook.

bSaveAsUI

True if the Save As dialog box will be displayed.

Return Value

The function should return TRUE to cancel any further processing of the save event. It should return FALSE (the default) to enable normal processing to continue.

Note that if you return TRUE, the file will not be saved.

Remarks

This function is called just before a workbook is saved.

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 does nothing and returns FALSE.

Implementation note

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

Requirements

Header: xllplus.h

See Also

CXllApp Class | CXllApp Methods | CXllApp::OnNewWorkbook() | CXllApp::OnWorkbookOpen() | CXllApp::OnWorkbookBeforeSave()