Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm using code I found in an earlier email thread to save/close a workbook
after 1 minute, after prompting the user to see if he/she is still there (resets the timer if Yes is clicked). The code works fine as long as the user has exited out of a data field. But if the user has entered data in a field but hasn't clicked out of it, the wkbook stays open as it would if the code weren't there. 1) How can I force it to exit the field, save whatever has been entered & close? 2) I would also like to add a countdown message to the "Are you there?" prompt (i.e. "If you do not click Yes, this workbook will close in <# seconds"). How can I do that? The code being used is below: In Thisworkbook: Private Sub Workbook_Open() Application.OnTime Now() + TimeValue("00:01:00"), "CloseMe" End Sub In a New Module: Public Sub CloseMe() Dim SH As IWshRuntimeLibrary.WshShell Dim Res As Long Set SH = New IWshRuntimeLibrary.WshShell Res = SH.Popup(Text:="Are you still there?", secondstowait:=3, _ Title:="Doc Tracking List Check", Type:=vbYesNo) If Res = vbYes Then Application.OnTime Now() + TimeValue("00:01:00"), "CloseMe" Else ThisWorkbook.Save ThisWorkbook.Close End If End Sub -- Thanks for your help! JoAnn |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
save and close automatically an excel spreadsheet | Excel Programming | |||
I want to close down excel after 1 hour automatically | Excel Programming | |||
Is there a way to insert a formula, password or macro in an excel spreadsheet that will automatically delete the spreadsheet? | Excel Discussion (Misc queries) | |||
Automatically Close Excel | Excel Programming | |||
VBA code to automatically close file | Excel Programming |