Getting the events of other workbooks
How do I refer to an event and create a function for the event of another workbook?
I have a AddInWorkbook.xla that works as a add in and it needs to refer to whatever new workbook that the user opens. I need the new workbook to tell the AddInWorkbook.xla when the new workbook's closing event is dispatched.
So it is possible to do something like this in VBA Excel?
Or otherwise like adding a event listener to it? Possible?
PHP Code:
//inside AddInWorkbook.xla
ActiveWorkbook.addEventListener("Workbook_Close", closeHandler)
function closeHandler(Event e) {
if e.filename == ActiveWorkbook.filename {
//then from here I can carry on...
}
}
Re: Getting the events of other workbooks
create a class and declare it with events
set the class to the excel application
Re: Getting the events of other workbooks
Thanks.
But how do I declare the events and set the class to the application? Are there any examples? Sorry as this is the first time I am doing this.
Re: Getting the events of other workbooks
check in the help file
using events with application object
or
application object events
if you get stuck i can try to help, but it is not real hard once you start
Re: Getting the events of other workbooks
Thanks westconn. I found the page in the help file. I will try and let u know the result. Thank you so much!