Click here to Skip to main content
12,691,777 members (28,595 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# MS-Excel AddIn event

I have devised some code to execute a method whenever a new workbook named "Book1.xls" is opened using an event handler :


Is there a similar event handler for when a new instance of excel is created?

I have a situation where I would like my add-on to be executed under two conditions: 1) the user presses a button OR 2) the user exports a data table from a 3rd party program, and when that excel table opens, that event is handled by running the method. I have it working now with the current event handler, but I just found out that when I export the excel file from the 3rd party program, it opens it up in a new instance of excel, so my add-on does not "see" the new "Book1.xls" created. Thanks in advance!
Posted 19-Jul-12 17:41pm
Updated 19-Jul-12 17:56pm
Wes Aday104.2K

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

List of avalible events for MS Excel Application, you can find here:[^]

The most interesting events are:
NewWorkbook - Occurs when a new workbook is created. (Inherited from AppEvents_Event.) 'prefered
WorkbookBeforeXmlExport - Occurs before Microsoft Excel saves or exports data from any open workbook to an XML data file. (Inherited from AppEvents_Event.)
WorkbookBeforeXmlImport - Occurs before an existing XML data connection is refreshed or new XML data is imported into any open Microsoft Excel workbook. (Inherited from AppEvents_Event.)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170117.1 | Last Updated 5 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100