Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    922
    Thanks
    2
    Thanked 12 Times in 11 Posts

    Copy of open document (Word 11)

    I'm wondering if it's possible to make a copy of an open document -- including changes since it was last saved -- without using SaveAs. It seems that Word does this with Send to Mail Revipient as Attachment: the file that's open, including changes since it was last saved, is attached to the email. The user can then close the document without saving, and the Attachment as it was sent is not ever saved to disk.

    Is there some method that I can use to do something similar? I want the results of SaveAs, without having the "saved as" file appear on screen.

    Thanks,
    Richard Barrett

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

    Re: Copy of open document (Word 11)

    I don't think this is available to the user. You could write a macro that copies the contents of the document into a new document and saves this.

  3. #3
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    922
    Thanks
    2
    Thanked 12 Times in 11 Posts

    Re: Copy of open document (Word 11)

    I have had trouble doing this so that I get headers/footers from the source doc in the target document. Can you recommend something that will ensure I copy headers/footers from the source document and get them into the new document along with the main document story?

    Doing this manually, I have good results if I go into Header footer view and select all in the header and footer, return to the document, and then paste. rngNewDoc.sections(1).headers(wdHeaderFooterPrimar y).Range.Delete (and so on through the headers/footers of section 1) does not do the job.

    Thanks,
    Richard

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

    Re: Copy of open document (Word 11)

    The following wortks OK for me - it retains page setup, headers and footers etc.:

    Sub Clone()
    Dim docSrc As Document
    Dim docTrg As Document
    Set docSrc = ActiveDocument
    Set docTrg = Documents.Add
    docSrc.Content.Copy
    docTrg.Content.Paste
    ' Adjust name and if desired path of clone
    docTrg.SaveAs "Clone of " & docSrc.Name
    docTrg.Close
    End Sub

    If you want the user to specify the name for the clone, change

    docTrg.SaveAs "Clone of " & docSrc.Name

    to

    docTrg.Save

  5. #5
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    922
    Thanks
    2
    Thanked 12 Times in 11 Posts

    Re: Copy of open document (Word 11)

    Thanks. This was similar to the code I was using. Apparently Word considered my normal.dot to be "dirty" and didn't get the headers/footers. I created a template called blank.dot. It's based on a fresh normal.dot created by Word, as opposed to our own version. This made all the difference.

    Regards,
    Richard

Posting Permissions

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