I'll paste the macro. To get the original, go to the lounge at WWW.Wopr.com
Click on Search and then choose the Word Forum
In the Search for box enter 127677
The Search Option should be Message #
(Thanks to Jefferson Scher)
Sub FileSave()
' Saves as usual then makes a shadow copy
' Requires a reference to the Microsoft Scripting Runtime
' If document has not changed, then do nothing
If ActiveDocument.Saved Then Exit Sub
' Save or, if doc has never been saved, pop SaveAs
If ActiveDocument.Path = vbNullString Then
If Dialogs(wdDialogFileSaveAs).Show = 0 Then
' User chose Cancel, get out now!
Exit Sub
End If
Else
ActiveDocument.Save
End If
' Copy saved file to shadow folder
' FileCopy does notwork on an open file, so...
Dim objFS As New FileSystemObject
If Not objFS.FolderExists("c:\MyShadow") Then
objFS.CreateFolder "c:\MyShadow"
End If
objFS.CopyFile ActiveDocument.FullName, "c:\MyShadow\" & ActiveDocument.Name, True
Set objFS = Nothing
End Sub
I'm sure many people will want to experiment with this. Please be careful that you don't forget to Save first in your macros that intercept these commands, or only the old copy will get backed up and you will be very unhappy.
If you wanted to back up "time stamped" copies of the file, you could change the latter half of the macro as follows:
' Copy saved file to shadow folder
' FileCopy does not work on an open file, so...
Dim objFS As New FileSystemObject, fileDoc As File, strFName As String
If Not objFS.FolderExists("c:\MyShadow") Then
objFS.CreateFolder "c:\MyShadow"
End If
Set fileDoc = objFS.GetFile(ActiveDocument.FullName)
strFName = Left(ActiveDocument.Name, InStrRev(ActiveDocument.Name, "."))& _
Format(fileDoc.DateLastModified, "yy-mm-dd.hhnnss") & _
Right(ActiveDocument.Name, Len(ActiveDocument.Name) - _
InStrRev(ActiveDocument.Name, ".") + 1)