Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This workbook
------------- Private Sub Workbook_BeforeClose(Cancel As Boolean) MsgBox "Closing timer: " & nextime On Error GoTo xxx Application.OnTime nextime, "chkexit", , False MsgBox "timer cancelled" Exit Sub xxx: MsgBox "error while cancelling the timer" End Sub Private Sub Workbook_Open() delay = TimeValue("00:00:50") nextime = Now + delay MsgBox "You will get a prompt for saving and exiting after " & delay & " which is at " & nextime Application.OnTime nextime, "chkexit", , True End Sub module1 -------- 'Type the following two lines in the declarations section Public nextime As Date Public delay As Date Sub chkexit() If MsgBox("The timer " & nextime & " has elapsed.Do you want to continue working", vbYesNo) = vbYes Then nextime = Now + delay MsgBox "You will get another prompt in " & delay & "which is at " & nextime Application.OnTime nextime, "chkexit", , True Else ActiveWorkbook.Close End If End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Find %ontime & SUMIF ontime ie: find matching sets within Range... | Excel Worksheet Functions | |||
Autoclose code from Bob Phillips not working for me | Excel Programming | |||
Workbook Autoclose ... | Excel Discussion (Misc queries) | |||
OnTime / TimeValue | Excel Programming | |||
Break all links on autoclose | Excel Programming |