Excel OnWorkbookBeforeSave

Add-in Express™ Support Service
That's what is more important than anything else

Excel OnWorkbookBeforeSave
Does it work? 
David Golden

Posts: 11
Joined: 2006-03-07
Hi All,

I've been working fairly heavily with ADX controls etc over the past few weeks, but for the life of me I cannot figure out how to take control of Excel's save feature and make it work.

I've even tried using the VCL example OnWorkbookbeforeSave thats in the support area, but the event just doesn't fire.

Heres a snippet of some of my code...

procedure TAddInModule.adxCOMAddInModuleAddInInitialize(Sender: TObject);
case HostType of
ohaExcel: begin
ExcelApp.OnWorkbookBeforeSave := DoWorkbookBeforeSave;
ohaWord: begin
ohaOutlook: begin

procedure TAddInModule.DoOnWorkbookBeforeSave(ASender: TObject;
const Wb: ExcelWorkbook; SaveAsUI: WordBool; var Cancel: WordBool);
ShowMessage('User is trying to save');

When I debug this, it sets the Procedure as the replacement, but this never fires... Is it something silly I'm missing or does this not work?

Testing on Office 2002 SP3, using XP SP2.


Posted 07 Mar, 2006 23:19:09 Top
Dmitry Kostochko

Add-in Express team

Posts: 2875
Joined: 2004-04-05
Hi David,

I have just created and tested a simple add-in based on your code. Works fine with Excel XP SP3 and Excel 2003 SP2. Please contact me by email, I will send you my code example for testing.

Posted 08 Mar, 2006 07:21:08 Top