Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 542
Default Close workbook timer with notification

hi all,
Is there a way to close a workbook if it has been at idle for a certain
amount of time? Id like it to also display that its going to close in
20...19....18....17...etc (a countdown) and an option to keep it open. The
idle criteria should reset if a combo box on a sheet has been clicked (or got
focus) or if another sheet has been activated. thanks for the help
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Close workbook timer with notification

James,

You could use the following code:

shutdowntime = 5 'Time in second for shutdown
currenttime = timer

While timer <= shutdowntime + currenttime
DoEvents
'Update the statusbar to show how many second remain. Could
'also use a userform to show the remaining time
Application.StatusBar = Round(5 - (timer - currenttime), 0) & _
" seconds left before closing down"
Wend


If MsgBox("Close file", vbYesNo, "Auto shutdown") = vbYes Then
'Code to close
.....................
'Reset the statusbar
Application.StatusBar = False
Else
'Code to keep open
..........................
'Reset the statusbar
Application.StatusBar = False
End If
End Sub

"James" wrote:

hi all,
Is there a way to close a workbook if it has been at idle for a certain
amount of time? Id like it to also display that its going to close in
20...19....18....17...etc (a countdown) and an option to keep it open. The
idle criteria should reset if a combo box on a sheet has been clicked (or got
focus) or if another sheet has been activated. thanks for the help

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Keep Timer Going While Altering Workbook roadkill Excel Programming 1 December 19th 07 11:45 PM
Open New Workbook / Save and Close Current Workbook Joe K. Excel Programming 1 December 7th 07 08:04 PM
Timer to close workbook when no activity detected swedbera Excel Programming 7 June 26th 06 09:22 PM
Stopping a Timer / Running a timer simultaneously on Excel Paul23 Excel Discussion (Misc queries) 1 March 10th 06 12:08 PM
Close a the current workbook and load another specified workbook Adrian[_7_] Excel Programming 4 August 7th 04 05:29 PM


All times are GMT +1. The time now is 01:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"