Excel 2013 - SheetBeforeDelete event

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

Excel 2013 - SheetBeforeDelete event
 
Bob Devine


Guest


For various reasons I've always used my own code within my add-in-express add-ins to connect to Excel and handle events. I previously used the ROT, got a reference to the start-up workbook and then a reference to the Excel application. I've recently moved to Excel 2013 and, of course, it starts without an initial workbook being created so my old code no longer works (there's no workbook in the ROT).

I therefore decided to use the in-built ExcelApp, but it doesn't appear to expose the SheetBeforeDelete event. Any suggestions either for (i) getting an Excel reference from the ROT from within an add-in at start-up or (ii) get access to SheetBeforeDelete using the in-built Excel ref?

Thanks, Bob
Posted 14 Feb, 2020 19:03:09 Top
Andrei Smolin


Add-in Express team


Posts: 18828
Joined: 2006-05-11
Hello Bob,

SheetBeforeDelete was introduced on the Excel Application object in Office 2007. Make sure you use the type library of Excel 2007 or later.


Andrei Smolin
Add-in Express Team Leader
Posted 17 Feb, 2020 05:09:39 Top
Bob Devine


Guest


Thanks Andrei - I've been so wedded to using my own code I'm neglecting functionality that's already in ADX :-) Out of interest, how does the add-in get a reference to the Excel app object in v2013, given that it's not in the ROT at start-up? Are you using RegisterActiveObject? I can't see it in the source (I'm on Pro) so I assume it's in the enterprise version.

Thanks, Bob
Posted 17 Feb, 2020 08:39:57 Top
Andrei Smolin


Add-in Express team


Posts: 18828
Joined: 2006-05-11
Hello Bob,

A COM add-in implements the IDTExtensibility2 COM interface. The IDTExtensibility2.OnConnection method provides the add-in with a reference to the host application's Application object.


Andrei Smolin
Add-in Express Team Leader
Posted 17 Feb, 2020 09:50:43 Top