PDA

View Full Version : Word 2013 VBA documents.open opens file then shows error file already open



RCGUA123
07-17-2014, 07:00 AM
I have a macro that opens an XML file, makes some changes, saves and closes the file. The file exists but is definitely not open when the code gets to the point below. Just before the file opens I get an error message saying: "Run-time error '-2147024864 (80070020) The process cannot access the file -filename here- because it is being used by another process." If I end the macro, close the .xml file and restart the macro I don't get the error message the second time.


Documents.Open FileName:=strInfoXMLName, ConfirmConversions:=False, ReadOnly:= _
False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:= _
"", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="", _
Format:=wdOpenFormatText, XMLTransform:="", Encoding:=1252