leopaulc
12-04-2012, 11:02 AM
Dear All ,
I am using the below macro to close the workbook after crossing the time limit.
In workbook, i pasted the below one
Private Sub Workbook_Open()
Application.OnTime Now + TimeValue("00:03:00"), "close1_Me"
End Sub
and in the module,
Sub close_me()
ThisWorkbook.Close Savechanges:=True
End Sub
Sub close1_me()
Dim objWsh As Object, msg As String
Const Delay As Long = 3 'secs ?
Const wButtons As Long = 16 ' Boutons + icon
Set objWsh = CreateObject("WScript.Shell")
msg = "Please update the file. The file will close within 10 sec."
objWsh.Popup msg, Delay, "Reminder !!!!!!!!", wButtons
Application.OnTime Now + TimeValue("00:00:10"), "close_Me"
Set objWsh = Nothing
End Sub
Now the problem is, if i am clossing before 3 mins (before time limit), it opens the file and asks for the clossure.
The same repeats sometimes till i close all the workbook which is opened earlier.
If it is clossing normally, there is no error or loop is appeared.
Please help..
Regards,
Leo Paul
I am using the below macro to close the workbook after crossing the time limit.
In workbook, i pasted the below one
Private Sub Workbook_Open()
Application.OnTime Now + TimeValue("00:03:00"), "close1_Me"
End Sub
and in the module,
Sub close_me()
ThisWorkbook.Close Savechanges:=True
End Sub
Sub close1_me()
Dim objWsh As Object, msg As String
Const Delay As Long = 3 'secs ?
Const wButtons As Long = 16 ' Boutons + icon
Set objWsh = CreateObject("WScript.Shell")
msg = "Please update the file. The file will close within 10 sec."
objWsh.Popup msg, Delay, "Reminder !!!!!!!!", wButtons
Application.OnTime Now + TimeValue("00:00:10"), "close_Me"
Set objWsh = Nothing
End Sub
Now the problem is, if i am clossing before 3 mins (before time limit), it opens the file and asks for the clossure.
The same repeats sometimes till i close all the workbook which is opened earlier.
If it is clossing normally, there is no error or loop is appeared.
Please help..
Regards,
Leo Paul