• Avoid ‘locked for editing’ dialog? (Word 2000)

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Avoid ‘locked for editing’ dialog? (Word 2000)

    • This topic has 4 replies, 2 voices, and was last updated 20 years ago.
    Author
    Topic
    #417829

    Is it possible to suppress the “This document is locked for editing…” message that Word displays when trying to open a document that someone else already has open? I know that some dialogs and warnings can be avoided by using Application.DisplayAlerts, but apparently this one is displayed regardless.

    Thanks!

    Viewing 0 reply threads
    Author
    Replies
    • #938806

      I’m guessing it depends on what you want Word to do instead, as two users can’t be editing the same file at the same time. (Or to be more accurate, they could both edit the document, but one of their edits would be lost). You can set Word documents to always open in “Read-only” mode to stop people locking it for editing, although you may well get a “This document is read-only” message instead.

      Post 223813 highlights a bug that bypasses the message, but with unpleasant consequences! (And it’s an expensive workaround as it could involve buying another computer!!) The bottom line here is that the message is there for a very good reason, and you need to think carefully about how you’re going to handle file-sharing if you don’t use the default options.

      Hope this helps,

      • #938888

        I was asking on behalf of one of our programmers, who is trying to automate Word to do a mail merge as part of a larger process (I’m not perfectly clear on all the details). Sometimes he is trying to open the merge document when another process has it open, which is causing the “locked for editing” dialog. He is not going to be editing the document, so it shouldn’t hurt (as far as I know!) to just open it as a read-only document, continue with the merge, and then close it again. The whole thing needs to eventually run completely hands-off on an unmonitored batch processor, so we need to avoid any messages or dialog boxes, or find ways to handle them when they appear.

        Thanks!

        • #939007

          Ah, in that case it’s possible to specify in the code to open the document as read-only:

          Documents.Open “Filename”, , True

          That should solve the problem; if it doesn’t, I’m afraid I’m out of ideas… sorry

          • #939079

            We played with that a little bit yesterday, but it seemed that even when opening a document specifically as read-open (either manually in Word or via code), we still get the warning message — even though it seems overkill at that point, to tell you that you can only open a document read-only when you’ve asked Word to open it read-only! I believe that they’re going to try an end-run around the problem by making a separate copy of the merge document with a unique name, using that for the merge process, and then deleting it when done. Not nearly as elegant as suppressing a dialog, but it ought to work.

            Thank you anyway!

    Viewing 0 reply threads
    Reply To: Avoid ‘locked for editing’ dialog? (Word 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: