Error Message: Word Cannot Save This File Because It Is Already Open Elsewhere

Article translations Article translations
Article ID: 832287 - View products that this article applies to.
Expand all | Collapse all

On This Page

SYMPTOMS

When you run a Microsoft Visual Basic for Applications (VBA) macro in Microsoft Word to open and then to save the changes to a Word document, you may receive the following error message:
Word cannot save this file because it is already open elsewhere.
(\\server\share\filename.doc)
For example, this problem may occur when you run a VBA macro that is similar to the following example:
Sub Test()

Dim WordDoc As Word.Document

   'Open the file (using UNC name) in Word
   Set WordDoc = Application.Documents.Open("\\server\share\filename.doc")

   'Save Changes to the same file name (using UNC name)
   WordDoc.SaveAs "\\server\share\filename.doc", wdFormatDocument

   WordDoc.Close

End Sub

CAUSE

This problem may occur if you have a mapped drive to the same location that your VBA macro is trying to save changes to the document.

WORKAROUND

To work around this problem, use one of the following methods.

Method 1: Use the ActiveDocument.FullName Property

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. To work around this problem, use the ActiveDocument.Fullname property as in the following macro example:
Sub Test()

   Dim WordDoc As Word.Document

   'Open the file (using UNC name) in with word
   Set WordDoc = Application.Documents.Open("\\server\share\filename.doc")
        
   'Save Changes to the same file name (using the mapped drive)
   ActiveDocument.SaveAs ActiveDocument.FullName
        
   WordDoc.Close

End Sub

Method 2: Disconnect Your Mapped Drive

To work around this problem, disconnect your mapped drive before you run your VBA macro. To disconnect your mapped drive, follow these steps:
  1. Right-click Start, and then click Explore.
  2. On the Tools menu, click Disconnect Network Drive.
  3. In the Disconnect Network Drives dialog box, select the mapped drive that you want to disconnect, and then click OK.

Properties

Article ID: 832287 - Last Review: September 18, 2011 - Revision: 4.0
APPLIES TO
  • Microsoft Word 2002
Keywords: 
kberrmsg kbprb KB832287

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com