rjplante
Well-known Member
- Joined
- Oct 31, 2008
- Messages
- 569
- Office Version
- 365
- Platform
- Windows
I have a spreadsheet that I have set up an autosave timer using VBA (see code below). When I close the workbook the timer keeps running, and will open the workbook to resave the document if I have other spreadsheets open. How do I kill the timer when the workbook closes? I know I will add it to the ThisWorkbook code window, and use the before close option, but what is the line of code to abort the timer?
Tanks for the help.
Tanks for the help.
VBA Code:
Sub SaveThis()
Application.DisplayAlerts = False
ThisWorkbook.Save
Application.DisplayAlerts = True
Application.OnTime Now + TimeValue("00:05:00"), "SaveThis"
End Sub