Results 1 to 4 of 4
  1. #1
    Lounger
    Join Date
    Mar 2006
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi All

    Many, many years ago, back in my days of WordPerfect, I had a macro that would save a document in 2 locations at the same time. For example, by simply pressing a toolbar button once, I could save to a floppy disk as well as to the C:\ drive. Is there a macro like this in Word 2007 or can a macro be made to do this?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    You could use this macro:

    Code:
    Sub Save2Copies()
      Const strOtherPath = "C:\Word\"
      Dim strFullName As String
    
      On Error GoTo ErrHandler
    
      If InStr(ActiveDocument.FullName, "\") = 0 Then
    	MsgBox "Please save the document a first time, then try again.", vbExclamation
    	Exit Sub
      End If
      strFullName = ActiveDocument.FullName
      Application.DisplayAlerts = wdAlertsNone
      ActiveDocument.SaveAs strOtherPath & ActiveDocument.Name
      ActiveDocument.SaveAs strFullName
      Application.DisplayAlerts = wdAlertsAll
      Exit Sub
    
    ErrHandler:
      MsgBox Err.Description, vbExclamation
    End Sub
    and assign it to a button on the Quick Access Toolbar.

  3. #3
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    Hi Hans,

    Personally, I'd use ActiveDocument.Save for the open version and Application.FileCopy for the duplicate, rather than doing two SaveAs processes - that way, the copies in both folders will have the same attributes. A particular problem using the SaveAs approach is that it destroys any record of the file's original creation date, which can mess things up if the document contains fields based on that value. Also, ActiveDocument.SaveAs is dangerous where floppy drives are concerned, due to the potential corruption that can lead to.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Hi Paul,

    I agree that FileCopy would be better, but if I try that while the document is open, I get error 70 "Access denied" because the file is in use.

Posting Permissions

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