Found a nice post about exactly what to do but when I save the workbook, I get compiler error.
I placed this in the Workbook section:
Private Sub Workbook_Open()
StartTimer
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
StopTimer
End Sub
and this in the General:
Option Explicit
Public RunTime
Sub StartTimer()
RunTime = Now + #12:05:00 AM#
Application.OnTime RunTime, "SaveBook", schedule:=True
End Sub
Sub SaveBook()
ActiveWorkbook.Save
StartTimer
End Sub
Sub StopTimer()
On Error Resume Next
Application.OnTime RunTime, "SaveBook", schedule:=False
End Sub
When I save the workbook, I get a highlight on StartTimer in the Private Sub Workbook_Open() and it says Compile error:
Sub or Function not defined
Any help would be appreciated.
Wayne
Bookmarks