Userform Timed with Timer Cancellation Button.

fben96

New Member
Joined
Jul 30, 2018
Messages
15
I have a timer once my workbook opens, after one minute aUserform pops up, and asks if you are still using the file. If you hit yes, theoriginal timer resets but if you hit no the workbook closes. However, when theuserform pops up a second timer starts, when this timer times out it closes theworkbook. I would like for the second timer to be cancelled if the user clicksyes in the userform. Here is my code. Thus far.

HTML:
Sub Start_Time()
Application.OnTime Now + TimeValue("00:01:00"), "Time_Form"
End Sub
Sub Time_Form()
TimerForm.Show vbModeless
End Sub
Sub Closeout()
Application.DisplayAlerts = True
ThisWorkbook.Save
ThisWorkbook.Close
End Sub

this is the code for the userfom

HTML:
Private Sub NoButton_Click()
Call Closeout
End Sub
Private Sub UserForm_Initialize()
Application.OnTime Now + TimeValue("00:01:00"), "Closeout"
End Sub
Private Sub YesButton_Click()
Unload Me
Application.OnTime Now + TimeValue("00:01:00"), "Start_Time"
IsNull (Ln = 8)
End Sub


 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

Forum statistics

Threads
1,214,920
Messages
6,122,279
Members
449,075
Latest member
staticfluids

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