Kemidan2014
Board Regular
- Joined
- Apr 4, 2022
- Messages
- 229
- Office Version
- 365
- Platform
- Windows
In "ThisWorkbook"
In a seperate module
I have this autoclose macro set up in a work book, and it tends to and i dont think this is the proper term but Latched open to where it will re-open the file after it closes it when user has another unrelated excel work book open
is there anything that can be done or an option i can tell them to flag to prevent this?
VBA Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call StopTimer
End Sub
Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Call StopTimer
Call SetTimer
End Sub
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
Call StopTimer
Call SetTimer
End Sub
In a seperate module
Code:
Dim DownTime As Date
Sub SetTimer()
DownTime = Now + TimeValue("00:15:00")
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 Workbooks("Customer Complaint Tracker.xlsm")
.Saved = True
.Close
End With
End Sub
I have this autoclose macro set up in a work book, and it tends to and i dont think this is the proper term but Latched open to where it will re-open the file after it closes it when user has another unrelated excel work book open
is there anything that can be done or an option i can tell them to flag to prevent this?