Hi, I have vba code, in "This Workbook" to close a spreadsheet after 2 minutes, with warnings at the very start, half way through and at the end. When I open the spreadsheet through and Excel icon, evrything is fine, however if I open it from a Hyperlink in another spreadsheet, data cannot be entered until the tab keys are used and data eneterd manually. The mouse is frozen until then.
Private Sub Workbook_Open()
Dim Start, TimeInMinutes
TimeInMinutes = 2 'Timer is set for 2 minutes.
' Gives initial warning then monitors timer for first minute
CreateObject("WScript.Shell").Popup "You have 2 minutes to enter your data, after that time, the Log will save and close.", 3, "Doc 34 Log Time Out "
Start = Timer
Do While Timer < Start + 60
DoEvents
Loop
' After first minute, gives second warning , then monitors time for another minute
CreateObject("WScript.Shell").Popup "This file has been open for 1 minute. You have 1 minute to select CREATE DOC 34, before Excel closes.", 3, "Doc 34 Log Time Out "
Start = Timer
Do While Timer < Start + 60
DoEvents
Loop
' After 2 minutes, gives final warning and automatically saves and closes the workbook
CreateObject("WScript.Shell").Popup " Doc 34 Log is now Saving and Closing", 3, "Doc 34 Log Time Out "
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub
The spreadsheet is on a network used by numerous users, only one at a time though. Sometimes it works on one PC but not another. I'm totally baffled. Anyone any ideas?
Bookmarks