PC Review


Reply
Thread Tools Rate Thread

Close workbook timer with notification

 
 
James
Guest
Posts: n/a
 
      15th Dec 2008
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 With Quote
 
 
 
 
Brotha Lee
Guest
Posts: n/a
 
      15th Dec 2008
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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
error in running workbook.close() func. after close excel from win Kayıhan Microsoft C# .NET 0 29th Mar 2009 12:49 AM
timer to close app mcnewsxp Microsoft Access Getting Started 4 8th Aug 2008 10:11 AM
Close Access, or Timer/Timer Event Help =?Utf-8?B?V2VuZHk=?= Microsoft Access VBA Modules 2 16th Apr 2007 03:54 AM
Timer to close workbook when no activity detected =?Utf-8?B?c3dlZGJlcmE=?= Microsoft Excel Programming 7 26th Jun 2006 09:22 PM
Excel 2000 Workbook close button hides instead of close Steven Robinson Microsoft Excel Misc 3 13th Aug 2003 11:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:37 PM.