timer re-opening spread sheet when other spreadsheets are open

Footballtend

New Member
Joined
Apr 13, 2021
Messages
5
Office Version
  1. 2013
Platform
  1. Windows
Hello,
I am not very familiar with VB, but doing some research I was able to get some code to make a timer that will let people know they have been in the workbook for 15 minutes by a message box. This is a shared spreadsheet. A few people have said that they will open the spread sheet, make changes, Save and close the workbook in under 15 minutes. Then when the 15 minutes elapses, the workbook will reopen. It only does this when there is another workbook open. Code is below. I did some digging but I cant seem to find the error.

I have this code in its entirety in "ThisWorkBook" and also is a Module.

-------------------------------------------
Option Explicit



Dim DownTime As Date

Sub workbook_open()

Call SetTimer

End Sub

Sub SetTimer()

DownTime = Now + TimeValue("00:15:00")

Application.OnTime EarliestTime:=DownTime, Procedure:="MsgBoxCriticalIcon", Schedule:=True

End Sub

Sub StopTimer()

On Error Resume Next

Application.OnTime EarliestTime:=DownTime, Procedure:="MsgBoxCriticalIcon", Schedule:=False

End Sub

Public Sub MsgBoxCriticalIcon()

MsgBox "Please close the file if no longer in use.", vbCritical

End Sub
----------------------------------------------------------------
If anyone could help it would be appreciated.

Thank you,
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Glad that worked for you & thanks for the feedback! :)
 
Upvote 0

Forum statistics

Threads
1,215,644
Messages
6,125,991
Members
449,278
Latest member
MOMOBI

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