Hey Guys,
Got this macro somewhere and it works good in a docm. but I want it to work in a dotm. Tried everything I know, not working. here's the code for the macro-
Code:
Option Explicit
Private Const mlngTimeout As Long = 5*60
Public gsngStartTime As Single
Private msngElapsed As Single
Public Sub AutoSave()
msngElapsed = Timer - gsngStartTime
If ThisDocument.Saved = True Then
gsngStartTime = Timer
ElseIf msngElapsed >= mlngTimeout Then
ThisDocument.Save
MsgBox "Remember to save your work regularly."
gsngStartTime = Timer
End If
Application.OnTime When:=Now + TimeValue("00:00:10"), Name:="Project.Module1.AutoSave"
End Sub
Here's what goes in the document-
Code:
Private Sub Document_Open()
gsngStartTime = Timer
Application.OnTime When:=Now + TimeValue("00:00:10"), Name:="Project.Module1.AutoSave"
End Sub
Any suggestions?