Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Automatically Closing a worksheet after 10 mins
Hi, I have a spreadsheet that a number of people need
access to. Problems is every now and then someone opens it and goes to a meeting or forgets to close it for some other reason. Is there any tidy way I can wait for 10 mins of inactivity then automatically save and close a spreadsheet ? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Automatically Closing a worksheet after 10 mins
Neil,
You can set the OnTime method when you open the workbook. This code goes in the ThisWorkbook code module Private Sub Workbook_Open() Application.OnTime Now + TimeSerial(0, 10, 0), "CloseWB" End Sub This is the code that closes the workbook, and goes in a standard code module Public Sub CloseWB() With ThisWorkbook .Save .Close End With End Sub Big problem here is that if a user updates the spreadsheet it will still close after 10 minutes. Therefore you need to trap changes and reset the OnTime method. This can be done using worksheet event code. This code goes into the worksheet code module Private Sub Worksheet_Change(ByVal Target As Range) Application.OnTime Now + TimeSerial(0, 1, 0), "CloseWB" End Sub -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Neil" wrote in message ... Hi, I have a spreadsheet that a number of people need access to. Problems is every now and then someone opens it and goes to a meeting or forgets to close it for some other reason. Is there any tidy way I can wait for 10 mins of inactivity then automatically save and close a spreadsheet ? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
i want to automatically save the data after every 2 mins in excel | Excel Worksheet Functions | |||
how can i convert a value quoted in hrs,mins,secs to just mins | Excel Worksheet Functions | |||
Adding minutes showing total in hours/minutes, i.e., 60 mins + 60 mins + 15 mins to total of 2 hours 15 mins? | Excel Discussion (Misc queries) | |||
How to convert numeric value to mins and addimg mins to Hrs. | Excel Worksheet Functions | |||
closing excel after 5 mins idle | Excel Programming |