Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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 19-Jul-12 17:41pm
Edited 19-Jul-12 17:56pm
Wes Aday94.3K
v3

1 solution

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

Solution 1

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.)
  Permalink  

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



Advertise | Privacy | Mobile
Web02 | 2.8.1411022.1 | Last Updated 5 Sep 2012
Copyright © CodeProject, 1999-2014
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