View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
chris100
 
Posts: n/a
Default Option in Excel to save a close a workbook inactive for 5 minutes


Hi there,

I tried the steps above with all the typo changes but could someone
please tell me how to set this up in the macro - i used the code below
in 'this workbook' and waited but nothing happened.

Help please (i'm sure i'm just having a thickie spell)

Option Explicit

Public nSaveWB As Date

Public Sub SetSaveWBTimer()
nSaveWB = Now + TimeSerial(0, 1, 0) ' 5 minutes
Application.OnTime nSaveWB, "SaveWB"
End Sub

Public Sub SaveWB()
ActiveWorkbook.Save
ActiveWorkbook.Close

End Sub
Option Explicit

Private Sub Workbook_Open()
SetSaveWBTimer
End Sub

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Range)
Application.OnTime nSaveWB, "SaveWB", , False
SetSaveWBTimer
End Sub


--
chris100
------------------------------------------------------------------------
chris100's Profile: http://www.excelforum.com/member.php...o&userid=25166
View this thread: http://www.excelforum.com/showthread...hreadid=390704