leopaulc
10-24-2011, 09:34 AM
Hi,
I was trying to make a code to close the workbook after a time period (in this code it is set to 30 sec)
It should give a warning message, before 10 sec of its closing event.
the code I have is as below.
But I am little confused that where the code to be pasted.. (in Workbook or in the module)
Please help..it is not working
Sub close_me()
ThisWorkbook.Close Savechanges:=True
End Sub
Sub close1_me()
MsgBox "Please update the file. The file will close with in 10 sec."
Application.OnTime Now + TimeValue("00:00:10"), "close_Me"
End Sub
Private Sub Workbook_Open()
Application.OnTime Now + TimeValue("00:00:30"), "close1_Me"
End Sub
I was trying to make a code to close the workbook after a time period (in this code it is set to 30 sec)
It should give a warning message, before 10 sec of its closing event.
the code I have is as below.
But I am little confused that where the code to be pasted.. (in Workbook or in the module)
Please help..it is not working
Sub close_me()
ThisWorkbook.Close Savechanges:=True
End Sub
Sub close1_me()
MsgBox "Please update the file. The file will close with in 10 sec."
Application.OnTime Now + TimeValue("00:00:10"), "close_Me"
End Sub
Private Sub Workbook_Open()
Application.OnTime Now + TimeValue("00:00:30"), "close1_Me"
End Sub