MisterBill314
New Member
- Joined
- Sep 18, 2011
- Messages
- 3
I am relativley new to VBA and most of my code is fitting together various things I find on the internet. However, there is one thing I am having a problem with and haven't been able to find a solution. Maybe it something really simple that I keep overlooking.
I have a spreadsheet the runs a BeforeClose event. Everything works fine if I only I have the one workbook open. However, if multiple workbooks are open when I close Excel, the BeforeClose event runs for whatever workbook is active, not necessarily the workbook the BeforeClose event is stored in.
How can I restrict the BeforeClose event to only run in the workbook it is stored in? At some point, I may also have multiple workbooks with different BeforeClose events that would need run only in their own workbook.
Thanks
I have a spreadsheet the runs a BeforeClose event. Everything works fine if I only I have the one workbook open. However, if multiple workbooks are open when I close Excel, the BeforeClose event runs for whatever workbook is active, not necessarily the workbook the BeforeClose event is stored in.
How can I restrict the BeforeClose event to only run in the workbook it is stored in? At some point, I may also have multiple workbooks with different BeforeClose events that would need run only in their own workbook.
Thanks