|
|
|
|
|
|
Word
|
Autosave document at selected intervals or run other code at intervals
|
|
Ease of Use
|
Easy
|
Version tested with
|
2003
|
Submitted by:
|
mdmackillop
|
Description:
|
Documents based on this template will prompt for a save location on creation and will save automatically at defined intervals.
|
Discussion:
|
Reduce the risk of closing without saving. The document will save every 15 seconds (as set)
If you need to run any code at intervals, the same methodology can be used.
|
Code:
|
instructions for use
|
Option Explicit
Private Sub Document_New()
ActiveDocument.Save
SaveTime
End Sub
Option Explicit
Sub SaveTime()
Application.OnTime When:=Now + TimeValue("00:00:15"), _
Name:="DoSave"
MsgBox "Save routine running"
End Sub
Sub DoSave()
If ActiveDocument.Saved = False Then
ActiveDocument.Save
End If
SaveTime
End Sub
|
How to use:
|
- Save the attachment in your templates folder
- or
- Paste the relevant sections of code into ThisDocument and Standard modules as indicated.
|
Test the code:
|
- Open a new document based on the template.
- The annoying message box is for demo purposes and can be deleted.
|
Sample File:
|
DoSave.zip 5.84KB
|
Approved by mdmackillop
|
This entry has been viewed 111 times.
|
|