Monday, 18 December 2017

Excel - Forcing a Workbook to Close after Inactivity




These three routines are fairly straightforward. The first two respectively turn on the timer and turn it off. Note that these routines utilize the DownTime variable, which is declared outside of any of the routines. In this way its contents can be utilized in multiple routines.
The third routine, ShutDown, is the one that actually closes the workbook. It is only invoked if the OnTime method expires, at the end of an hour. It closes the workbook without saving any changes that may have been made.
The next routines (there are four of them) need to be added to the ThisWorkbook object. Open the VBA Editor and double-click on the ThisWorkbook object in the Project Explorer. In the code window that Excel opens, place these routines:








Microsoft Accredited IT Training Provider
Microsoft Certified Training Materials

IT Training Courses delivered by Microsoft Accredited Facilitators
Microsoft MOS Test Centre London



















No comments:

Post a Comment