Timer Code
Add this to a general module
Option Explicit
Public nTime As Double
Public Sub closemedown()
ThisWorkbook.Save
ThisWorkbook.Close
End Sub
and then add this to ThisWorkbook
Option Explicit
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.OnTime nTime, "closemedown", , False
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
nTime = Now + TimeSerial(1, 30, 0)
Application.OnTime nTime, "closemedown"
End Sub
Private Sub Workbook_Open()
nTime = Now + TimeSerial(1, 30, 0)
Application.OnTime nTime, "closemedown"
End Sub
--
---
HTH
Bob
(change the xxxx to gmail if mailing direct)
"Al" wrote in message
...
Hello
I am having a problem with a file being left open and I would like code to
automatically close the file after 90 minutes after the last change on any
page in the wb with changes saved before the close.
Can this be done? How?
Thanks
|