Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
i want to automatically save the data after every 2 mins in excel gunjan.chowdhri Excel Worksheet Functions 2 May 28th 09 01:58 PM
how can i convert a value quoted in hrs,mins,secs to just mins The man from delmonte Excel Worksheet Functions 1 October 17th 06 11:12 AM
Adding minutes showing total in hours/minutes, i.e., 60 mins + 60 mins + 15 mins to total of 2 hours 15 mins? StargateFan Excel Discussion (Misc queries) 8 January 7th 06 07:35 PM
How to convert numeric value to mins and addimg mins to Hrs. ramana Excel Worksheet Functions 1 October 28th 05 10:42 AM
closing excel after 5 mins idle Mack B Excel Programming 1 January 20th 04 09:41 AM


All times are GMT +1. The time now is 11:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"