Hi Vinu,

I looked at the link provided by you.

I have attached a workbook with this email, i hope this resolves your
problem. I have used the following code:

Private Sub Workbook_Open()
'Advise the user the workbook will close if inactive for 10 seconds.
'To adjust the time, such as if you want to allow 1 hour and 15 minutes,
'change this line
Application.OnTime Now + TimeSerial(0, 45, 0), "CloseMe"
Application.OnTime Now + TimeSerial(0, 60, 0), "CloseMe"
'and remember to update the message box.
MsgBox "This workbook will close itself after 10 seconds.", 48, "FYI..."
Application.OnTime Now + TimeSerial(0, 0, 10), "CloseMe"
End Sub

This code will fire a ontime macro, which will run as follows:

1) After 45 mins, user will get a warning message that the sheet will close
after 15 mins

2) After 60 mins, the sheet will close

The following code needs to be placed in the Module:

Private Sub CloseMeWarning()
MsgBox "45 mins have elapsed, you have 15mins left on the exam!", vbCritical
+ vbOKOnly
End Sub

End Sub

Private Sub CloseMe()
ThisWorkbook.Close True
End Sub

End Sub


Cheers!

Harry

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 6,800 subscribers worldwide and receive many nice notes about the 
learning and support from the group.Let friends and co-workers know they can 
subscribe to group at http://groups.google.com/group/excel-macros/subscribe

Attachment: SAmple.xls
Description: MS-Excel spreadsheet

Reply via email to