[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Bob Phillips

12/11/2006 2:25:00 PM

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" <Al@discussions.microsoft.com> wrote in message
news:C97B877A-045C-435F-8E5E-E50D419C7999@microsoft.com...
> 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