ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   set time limit before closing sheet (https://www.excelbanter.com/excel-programming/279466-set-time-limit-before-closing-sheet.html)

Maria Johansson

set time limit before closing sheet
 
Hello,

I have a xls-file used by several people and I wish this
file to be automatically closed after an hour.
Any suggestions?

Thanks, Maria


Nick Hodge[_3_]

set time limit before closing sheet
 
Maria

Not sure how reliable this would be, it might have issues if a user is
editing a cell when the code runs, but this will shut down the workbook
after 1 hour from opening. The top code goes in the ThisWorkbook module and
the bottom code in standard module. Post back for help on placing this.

The first code fires when the workbook is opened which runs the second code
after 1 hour. It saves the workbook. You may wish to refine it by adding
warnings to users, etc!


Private Sub Workbook_Open()
Application.OnTime EarliestTime:=Now() + TimeValue("01:00"),
Procedu="ShutDown"
End Sub

Sub ShutDown()
ThisWorkbook.Close SaveChanges:=True
End Sub


--
HTH
Nick Hodge
Southampton, England



"Maria Johansson" wrote in message
...
Hello,

I have a xls-file used by several people and I wish this
file to be automatically closed after an hour.
Any suggestions?

Thanks, Maria




[email protected]

set time limit before closing sheet
 
Of course, there are ways to circumvent such schemes (such as diabling
macros), but here is a suggestion.

http://tinyurl.com/qu9r

HTH
Paul
--------------------------------------------------------------------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------------------------------------------
I have a xls-file used by several people and I wish this
file to be automatically closed after an hour.
Any suggestions?

Thanks, Maria




All times are GMT +1. The time now is 09:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com