Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

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
 
Old May 2nd, 2007, 03:20 PM
Registered User
 
Join Date: May 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Detecting Application stop/end

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?



 
Old May 7th, 2007, 10:37 AM
Friend of Wrox
 
Join Date: Feb 2007
Posts: 163
Thanks: 0
Thanked 2 Times in 2 Posts
Default

For trapping when not in a form in Excel, use this:

Application.OnKey "^{BREAK}", "My_Subroutine"

Is this what you needed?






Similar Threads
Thread Thread Starter Forum Replies Last Post
Stop button won't stop loop JDShaffer Visual Basic 2008 Essentials 3 May 23rd, 2008 03:22 PM
Ms Access front End with Oracle 10g Back End rahul123 Oracle 1 July 9th, 2007 01:03 AM
Oracle back-end MS-Access 2003 client front-end Corey Access 2 February 16th, 2007 08:31 AM
Oracle Back End - MS Access Front End - Multi User ckaliveas Oracle 1 February 1st, 2007 06:00 AM
Using Front-End Application To Update Database Ben Horne Flash (all versions) 5 July 2nd, 2004 02:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.