Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jul 2008
    Location
    Suffolk, United Kingdom
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    check filelock before opening (2003)

    Hi Everyone,

    I am having a problem with documents deleting themselves on open.

    Here is some background into what we are doing and our systems.

    We currently are using a toolbar which we developed using word VBA to open leters that are filed in a sett structure using their 6 digit client number. They are stored in various directories withing one main directory.

    The toolbar uses a drop down to select the department, and a text box to enter the 6 digit file name an on event macro is then run to take that data in the toolbar to find and open the correct letter.

    The problem.
    If a user try's to open the letter at the exact time another user closes the same letter a message box appears saying the file is corrupt on clicking OK word stops trying to open the letter. When then trying to open the letter again it is no longer there (deleted).

    Attached is the code used to open the letters, is there a way of varifing if the letter is fully closed before the macro try's to open the letter?

    Thanks
    Attached Files Attached Files
    Regards
    Gerbil (AKA Kevin)

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

    Re: check filelock before opening (2003)

    I don't understand why the document would be deleted, but I don't think there is much you can do about it. Even if you could perform a check, the situation might have changed the next moment when you actually try to open the document.

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: check filelock before opening (2003)

    I haven't checked this in many years, but my understanding was that Word creates a temporary file when you save, and then replaces the original file with the temporary file when you closed the document. I thought this replacing was done by deleting the original file and renaming the temp file. If there is a failure during this last step, the original file may be gone but the temp file still should be available. You can use a tool like the SysInternals Process Monitor to log a program's disk activity. However, this is a client-side tool, so you would need to turn on file auditing on the server to record the events resulting from multiple users' simultaneous access.

    Added: That didn't answer your question about checking the file lock. If you look in any folder with an open Word document, you can see the file name pattern for the lock file. I don't know exactly when this lock file is removed, so you'll need to experiment to know whether it will solve the problem you're encountering.

Posting Permissions

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