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

Blanchetdb

Board Regular
Joined
Jul 31, 2018
Messages
161
Office Version
  1. 2016
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

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
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,223,883
Messages
6,175,168
Members
452,615
Latest member
bogeys2birdies

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