Hi,
Does anyone know if there's a BeforeClose Application event, rather than a BeforeClose Workbook event? Or some way to disable the main Application Close button when more than one workbook is open?
I'm having a problem with some workbooks that rely heavily on event macros. The workbooks are, essentially, identical, with the same macros - just different data. If I have one workbook open, I can close it fine by using either the main Close button, or by using the Close Window button. If I have more than one workbook open I can also close fine using the Close Window button. However, with more than one workbook open, using the main 'Close' button, to close the whole application (i.e. all open workbooks), it causes some of my events subs to error.
The problem isn't so much with my coding (though I'm sure it could be vastly improved) but more with the sequence of events that are fired in this specific scenario. Hence my first question, about effectively disabling the application close event.
I might be able to code my way around this, but it's proving to be difficult (I've tried disabling event handling, btw - and it doesn't solve the problem).
Thanks for any suggestions.
Does anyone know if there's a BeforeClose Application event, rather than a BeforeClose Workbook event? Or some way to disable the main Application Close button when more than one workbook is open?
I'm having a problem with some workbooks that rely heavily on event macros. The workbooks are, essentially, identical, with the same macros - just different data. If I have one workbook open, I can close it fine by using either the main Close button, or by using the Close Window button. If I have more than one workbook open I can also close fine using the Close Window button. However, with more than one workbook open, using the main 'Close' button, to close the whole application (i.e. all open workbooks), it causes some of my events subs to error.
The problem isn't so much with my coding (though I'm sure it could be vastly improved) but more with the sequence of events that are fired in this specific scenario. Hence my first question, about effectively disabling the application close event.
I might be able to code my way around this, but it's proving to be difficult (I've tried disabling event handling, btw - and it doesn't solve the problem).
Thanks for any suggestions.