Activity Timer to count down..then save and close workbook

menor59

Well-known Member
Joined
Oct 3, 2008
Messages
574
Office Version
  1. 2021
Platform
  1. Windows
Exactly as it sounds...

If possible id like to have a Popup box that says the workbook will close in 2 minutes...then a timer below that that counts down from 120 to zero when theres no activity. If no activity is detected save and close the workbook. within the alotted time the pop box will have a button in it that says would you like to continue to work? If the user clicks that the pop up box goes away and the 5 minute timer kicks back in to play...

What I currently have in the MYWorkbook is the following...

Rich (BB code):
Private Sub Workbook_Open()
' Macro recorded 7/12/2002 by Justin
Worksheets("Table of Contents").Activate
Select Case Application.CanPlaySounds
    Case True
        sndPlaySound "C:\Windows\Media\Windows XP Startup.wav", 0
End Select
MsgBox ("For Support Contact: Justin" & vbNewLine & "Email: yada@yada.com" & vbNewLine & " " & vbNewLine & "**UPDATED INFORMATION (Oct 13, 2008):" & vbNewLine & "1. Table of Contents added and will prompt you if you dont have a worksheet created for the week." & vbNewLine & "2. Sound associated with Startup and Shutdown of the workbook." & vbNewLine & "3. Sound associated if current Work Week isn't created." & vbNewLine & "     It will then prompt you with the steps to creating a new Work Week." & vbNewLine & "4. Added option to send part of the work week or the entire workbook."), vbExclamation, "NetVersant - Northern California"
Range("A1").Select
Selection.ClearContents
Dim current_wk As Date: current_wk = DateAdd("d", 7 - Weekday(Date, vbMonday), Date)
Dim dummy As Variant
'check timesheet exists
On Error GoTo MissingSheet:
dummy = Sheets(Format(current_wk, "MMM DD, YYYY")).Cells(1, 1)
Call Hide_Worksheets_Reset
Worksheets("Table of Contents").Activate
Exit Sub
MissingSheet:
Select Case Application.CanPlaySounds
    Case True
        sndPlaySound "C:\Windows\Media\Notify.wav", 0
End Select
MsgBox "From the Table of Contents" & vbNewLine & "Please Create a Timesheet for Week Ending: " & Format(current_wk, "MMM DD, YYYY") & vbNewLine & " " & vbNewLine & "Select Option 1 and Create a New Timesheet first." & vbNewLine & "then once you are on the Blank Worksheet" & vbNewLine & "From the Pull down select this comming Sunday - Example: " & Format(current_wk, "MMM DD, YYYY") & vbNewLine & "then click 'Create New Timesheet'" & vbNewLine & "You will have a new Worksheet Labeled: " & Format(current_wk, "MMM DD, YYYY") & vbNewLine & "Enter your Time there. " & vbNewLine & "Save and Close or Email as you see fit.", vbExclamation, "Create a New Timesheet..."
Exit Sub
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Select Case Application.CanPlaySounds
    Case True
        sndPlaySound "C:\Windows\Media\Windows XP Shutdown.wav", 0
End Select
End Sub
and i have one UserForm1 defined that is tied to protect/unprotect Globally in the work Book. With a total of 16 Modules. If possible can i ask for step by step instructions to impliment this request if possible. This workbook was pieced together by all here on Mr Excel and i dont want to screw this up.

Synopsis once more...

Timer is set for 5 minutes of inactivity.
When 2 minutes are left a pop up window prompts the user...
Below that Timer:120 Countdown to Zero
A Button to Overide and reset back to 5 minutes.
If button isnt clicked...save and Close the Entire workbook.

Thank you again all here on Mr. Excel. My one stop source for answers.
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Forum statistics

Threads
1,215,982
Messages
6,128,104
Members
449,421
Latest member
AussieHobbo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top