You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
I have a continuously running program (by design). On the spreadsheet I have a command button that I change when starting the application from "Start" to "End". I would like to be able to detect when someone has used the CTRL - Break button to stop processing. This would result in the open files except for the file that the application/macro stops without properly shutting down. I want to also return the command button to "Start" and other program clean up chores.
I have found the "OnKey" object but I cannot find a way to activate it without having a form. I just use the spreadsheet and no extra forms. The other event that I see would be when the Workbook is deactivated. This will not work due to me switching between Workbooks for data consolidation.
In Access you have a form close event. Is there something similar for the application/macro stopping?