jtbrown1955
New Member
- Joined
- Jan 12, 2005
- Messages
- 40
I have this timer set up, but I want it disregarded if I'm in read only.
This is in ThisWorkbook
Private Sub Workbook_Open()
Reset
End Sub
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Reset
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Reset
End Sub
This is in Module1
Sub Reset()
Static SchedSave
If SchedSave <> 0 Then
Application.OnTime SchedSave, "SaveWork", , False
End If
SchedSave = Now + TimeValue("00:59:00") ' 59 minutes
Application.OnTime SchedSave, "SaveWork", , True
End Sub
Sub SaveWork()
If Application.ThisWorkbook.ReadOnly = True Then
Application.ThisWorkbook.Saved = True
Else
ThisWorkbook.Save
End If
ThisWorkbook.Close
End Sub
This is in ThisWorkbook
Private Sub Workbook_Open()
Reset
End Sub
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Reset
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Reset
End Sub
This is in Module1
Sub Reset()
Static SchedSave
If SchedSave <> 0 Then
Application.OnTime SchedSave, "SaveWork", , False
End If
SchedSave = Now + TimeValue("00:59:00") ' 59 minutes
Application.OnTime SchedSave, "SaveWork", , True
End Sub
Sub SaveWork()
If Application.ThisWorkbook.ReadOnly = True Then
Application.ThisWorkbook.Saved = True
Else
ThisWorkbook.Save
End If
ThisWorkbook.Close
End Sub