Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Mar 2002
    Thanked 0 Times in 0 Posts

    Document backup (Word 2000)

    This may seem like a silly question but... Is it possible to configure Word to save documents in 2 locations at the same time? For example to save to my documents folder on hard drive and also to floppy or network share without having to go the file save as route twice?

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Silicon Valley, USA
    Thanked 93 Times in 89 Posts

    Re: Document backup (Word 2000)

    Yes, but, you have to intercept Word's FileSave, FileSaveAs and FileClose commands and replace them with your own code. This might or might not be possible in your environment.

    I've attached a sample document containing a macro that intercepts the FileSave command. For quick reference, here it is:
    <pre>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
    End If
    ' Copy saved file to shadow folder
    ' FileCopy does not work 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</pre>

    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:
    <pre>' 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)
    Set fileDoc = Nothing
    objFS.CopyFile ActiveDocument.FullName, "c:MyShadow" & strFName, True
    Set objFS = Nothing</pre>

    Hope this helps.
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts