Click here to Skip to main content
15,889,898 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
All,

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

Excel.AppEvents_WorkbookOpenEventHandler(Application_WorkbookOpen)

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
Updated 19-Jul-12 16:56pm
v3

1 solution

List of avalible events for MS Excel Application, you can find here: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.application_events.aspx[^]

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.)
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900