-
Solved: Repeating code at intervals
Hi all,
I posted this in "another place" to repeat some code at intervals. Is there any potential memory or other problem in looping code like this?
[VBA]
Private Sub Document_Open()
Application.OnTime When:=Now + TimeValue("00:00:05"), _
Name:="Check1"
End Sub
Sub Check1()
Application.OnTime When:=Now + TimeValue("00:00:05"), _
Name:="Check2"
If ActiveDocument.Saved = False Then
MsgBox Now()
ActiveDocument.Save
End If
End Sub
Sub Check2()
Application.OnTime When:=Now + TimeValue("00:00:05"), _
Name:="Check1"
If ActiveDocument.Saved = False Then
MsgBox Now()
ActiveDocument.Save
End If
End Sub
[/VBA]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
-
You can just have the macro Check1 call itself instead of having a second sub. But there shouldn't be any problems.
-
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
-
You're Welcome
Take Care
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules