I need this to run automatically every specified amount of time, but this
code isn't working...
Public Sub AutoDelay()
Application.OnTime When:=Now + TimeValue("00:05:00"),
Name:="AutoSave"
End Sub
Public Sub AutoSave()
ActiveDocument.Save
End Sub
If you have a better suggestion, please post it. Thanks!
Peter - 18 Nov 2004 22:08 GMT
Some things to keep in mind when using the OnTime method:
- The macro that is going to be called at each interval needs to be public.
- You need to specify the name of the module with the macro name.
- Inside that macro, you need to reset the timer.
Public Sub AutoDelay()
Application.OnTime When:=Now + TimeValue("00:05:00"), Name:="Module1.AutoSave"
End Sub
Public Sub AutoSave()
ActiveDocument.Save
Application.OnTime When:=Now + TimeValue("00:05:00"), Name:="Module1.AutoSave"
End Sub
hth,
-Peter
> I need this to run automatically every specified amount of time, but this
> code isn't working...
[quoted text clipped - 10 lines]
>
> If you have a better suggestion, please post it. Thanks!