Error Message: Word Cannot Save This File Because It Is Already Open Elsewhere (832287)
The information in this article applies to:
- Microsoft Office Word 2003
- Microsoft Word 2002
SYMPTOMSWhen 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
CAUSEThis 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.WORKAROUNDTo work around this problem, use one of the following
methods. Method 1: Use the ActiveDocument.FullName PropertyMicrosoft 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 DriveTo work around this problem, disconnect your mapped drive before
you run your VBA macro. To disconnect your mapped drive, follow these steps:
- Right-click Start, and then click
Explore.
- On the Tools menu, click
Disconnect Network Drive.
- In the Disconnect Network Drives dialog
box, select the mapped drive that you want to disconnect, and then click
OK.
Modification Type: | Minor | Last Reviewed: | 7/27/2006 |
---|
Keywords: | kberrmsg kbprb KB832287 kbAudEndUser kbAudDeveloper |
---|
|