The code I am using works, and closes the workbook except for two cases: 1. There is an active cell. 2. You go to close, but forget to hit the 'Save', 'Don't Save', or 'Cancel' buttons.
Code Below, Can anyone help me out? Thanks.
ThisWorkbook:
Module:
Again, thanks!!
Code Below, Can anyone help me out? Thanks.
ThisWorkbook:
VBA Code:
Option Explicit
Private Sub Workbook_Open()
Call SetTimer
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call StopTimer
End Sub
Module:
VBA Code:
Dim DowntTime As Date
Sub SetTimer()
DownTime = Now + TimeValue("00:10:10")
Application.OnTime EarliestTime:=DownTime, Procedure:="ShutDown", Schedule:=True
End Sub
Sub StopTimer()
On Error Resume Next
Application.OnTime EarliestTime:=DownTime, Procedure:="ShutDown", Schedule:=False
End Sub
Sub ShutDown()
Application.DisplayAlerts = False
With ThisWorkbook
.Saved = False
.Close
End With
End Sub
Again, thanks!!