Countdown start upon opening of Workbook - close after 20 min.

Blanchetdb

Board Regular
Joined
Jul 31, 2018
Messages
164
Office Version
  1. 365
Platform
  1. Windows
Hi,

I presently have a workbook that numerous individuals can access but I need it the Workbook to automatically close after 20 minutes. I have entered coding and the workbook does close but regardless of the time I insert, it closes after 2 minutes

Private Sub Workbook_Open()
Application.OnTime DateAdd("n", 20, Now), "Thisworkbook.close_it"
End Sub


Sub Close_it()
ThisWorkbook.Close True
End Sub

what do I need to change so that it closes after 20 minutes and is it possible for a window to appear advising the person that they have 1 minute left until their session is closed?

thank you
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Message box would prevent file from closing until user responds

In ThisWorbook module
Code:
Private Sub Workbook_Open()
    Application.OnTime Now + TimeValue("00:20:00"), "CloseMacro"
End Sub

In STANDARD module
Code:
Sub CloseMacro()
    ActiveWorkbook.Save
    ActiveWorkbook.Close False
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

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