Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
This code closes the file after a period of inactivity
Option Explicit Private Sub Workbook_Open() nElapsed = TimeSerial(0, 5, 0) '5 minutes 'start a timer to countdown inactivity Application.OnTime Now + nElapsed, "Countdown" End Sub Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) 'any workbook activity resets the timer Application.OnTime nTime, "Countdown", , False nTime = Now + nElapsed Application.OnTime nTime, "Countdown" End Sub 'This is workbook event code. 'To input this code, right click on the Excel icon on the worksheet '(or next to the File menu if you maximise your workbooks), 'select View Code from the menu, and paste the code and in a standard code module Option Explicit Public nElapsed As Double Public nTime As Double Sub Countdown() ThisWorkbook.Close End Sub -- __________________________________ HTH Bob "MDS" wrote in message ... sIs it possible to set the length of time you can keep a workbook open for? I have several people updating a single file and oftentimes they leave it open on their desktop - thereby preventing others from updating it. I would like to set the amount of time a file can be open for so that other's can access it. Any ideas? Thanks. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Setting to automatically open a source file by double clicking on | Setting up and Configuration of Excel | |||
Setting a row to stay on top | New Users to Excel | |||
When i open excel file it takes time to open | Excel Discussion (Misc queries) | |||
Can Excel open a new application every time you open a file? | Setting up and Configuration of Excel | |||
How do I stop Excel from closing the open file each time I open a. | Setting up and Configuration of Excel |