Results 1 to 6 of 6
  1. #1
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Confirmation of logic sought here:

    It is not possible to clear the .Path or .Name of a saved document (Word or Excel). The VBA help files say that these properties are read-only.
    Fair enough.

    I am faced with an application that intercepts the File Save (Close/SaveAll/CloseAll etc) command and makes an audit-trail copy of the document before proceeding.
    The audit trail is typically a date-stamp filename "Audit_20090416_063018"), so that a dirty document, not previously saved ("Document1") now becomes "B:\Audit_20090416_063018".
    Then, prior to the CloseAll I ask the the user "Do you want to save changes?", and if the user Cancels out of the dialog box, I'd rather be able to leave the changed document as "Document1", but cannot reset the read-only properties of .Path and .Name.

    The only ugly solution I've dreamed up is to add a new document and migrate the content across; ugly because (1) the new document will not be "Document1" but "Document2" (2) migrating all story ranges, macros, properties etc. seems like too much coding-work to cope with an occasional user whim ("Cancel" out of a File CloseAll).

    I have considered doing the Audit save after asking "Do you want to save changes?", but am stuck with the feeling that we are doing the Audit save prior to anything else to save the user from embarrassing slips of fingers; that is, we want to "make the backup copy before letting the user near the data".

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Excel has the SaveCopyAs method which enables you to save a copy of a workbook without affecting the path and file and saved status. Word lacks that method, but I guess you can:
    1. Create a copy of the unsaved document (dunno how)
    2. Save that copy and close it.
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  3. #3
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Wellington, New Zealand
    Posts
    143
    Thanks
    0
    Thanked 1 Time in 1 Post
    I'm not sure that I fully understand what you're trying to do, but the only way I've found to save a copy of an unsaved Word document, while leaving the unsaved document intact, is via the (Word 2002) "File | Send To | Mail Recipient (as Attachment)" command. For me, this produces a document attached to an Outlook (2003) message pane.

  4. #4
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='pieterse' post='770822' date='16-Apr-2009 11:40']1. Create a copy of the unsaved document (dunno how)
    2. Save that copy and close it.[/quote]
    Thanks, Jan Karel.
    I did not know about Excel's SaveCopyAs , so that is a heads-up for me when I migrate the device to Excel.
    Your (1)&(2) suggestion is my "ugly" method I think. Stripped down, I could program the equivalent of copy-pasting the entire contents of the text into a new document. The downside remains the same - "Document2" instead of "Document1", and perhaps copying only the main body of text is not a great drawback, since a dirty unsaved document probably won't have a great deal of careful header/footer or VBA material at this early stage.
    My current thinking is to let sleeping dogs lie, and shrug this off as a minor aberration in the proposed system.

  5. #5
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='William' post='770972' date='16-Apr-2009 23:35']I'm not sure that I fully understand what you're trying to do, ...[/quote]
    Ah, but William, I think you do! You underrate yourself.
    Emailing a copy of the dirty unsaved document to myself (a.k.a. "the end-user") is an excellent vehicle for leaving the original document in its current state (dirty, unsaved) while making a backup copy somewhere else.

    I'll ponder this. Not every user will have Outlook installed, but exploring the possibility of sending the document outside the sphere of (in this case Word) and then recovering it for a saved copy would satisfy the requirements of making a periodic backup.
    Nice thinking, and food for my thoughts. Thank You.

  6. #6
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post
    Hi Chris
    At the beginning of your hijacking code I would be inclined to test the document in question to see if it has ever been saved, and if not, save it as "SpecialFolder\Document1.doc". Recognizing that the user has no claim on files in this folder once he has closed the file.

    FWIW
    As an added safeguard, I would set the file's properties to 'Read Only', thereby assuring that the user doesn't inadvertently save it to the SpecialFolder. Immediately after saving it, it should also be set to Dirty.
    Regards
    Don

Posting Permissions

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