Results 1 to 6 of 6
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    378
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Test whether document have ever been saved (Word97/NT)

    Hi

    How do I test to see whether a document has ever been saved? (I'm sure it's been covered before, but I can't find it.) I thought ActiveDocument.Path would do it, but I'm now looking at a never-saved document that has a path of "H:"???

    Thanks
    Dale

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

    Re: Test whether document have ever been saved (Word97/NT)

    That's strange, ActiveDocument.Path should be blank for a new document. You could test whether the name contains a point (from the extension):

    If InStr(ActiveDocument.Name, ".") > 0 Then
    ' Document has been saved
    Else
    ' Document hasn't been saved
    End If

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    378
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Test whether document have ever been saved (Word97/NT)

    False alarm, Hans. I wanted to force the user to save the document, so I tested the Path then issued an ActiveDocument.FileAs. (Wrong, Dale, should have been a "Dialogs (wdDialogFileSaveAs)".) Surprisingly (to me), Word now saves the document with a name of its choice in a folder of its choice (in this case, H.

    Ah well, I'll use the Dialogs statement (as I should have done in the first place), and it looks like Path remains a good test for never-savedness.

    Sorry for the blunder
    Dale

  4. #4
    3 Star Lounger
    Join Date
    Mar 2003
    Location
    Elkins Park, Pennsylvania, USA
    Posts
    325
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Test whether document have ever been saved (Word97/NT)

    At the risk of stating the obvious, doesn't checking the "Saved" property do what you need? ("If ActiveDocument.Saved = False Then...") Or, since it's Word 97/NT, wasn't there a property along the lines of "IsDirty"... I recall having to use that sometime in the past.
    <font face="Comic Sans MS">That's what you do in a herd; you look out for each other!</font face=comic> - Mike

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

    Re: Test whether document have ever been saved (Word97/NT)

    Dale's question was whether the document had ever been saved. The Saved property of a document only tells you whether it has been changed since the last save. If you open an existing document, and modify something, Saved will be False.

  6. #6
    3 Star Lounger
    Join Date
    Mar 2003
    Location
    Elkins Park, Pennsylvania, USA
    Posts
    325
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Test whether document have ever been saved (Word97/NT)

    D'oh! <img src=/S/doh.gif border=0 alt=doh width=15 height=15> I should have listened to that little voice...
    <font face="Comic Sans MS">That's what you do in a herd; you look out for each other!</font face=comic> - Mike

Posting Permissions

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