.Net 2.0 Word 2003 Addin - SaveAs not releasing original document

O

omega-bureau

I am having an issue where by when using the SaveAs on a document, it is
still keeping the original document held open, therefore not allowing me to
delete. This can be seen by looking at the document and the temp files
created, eg.

A new document is created and saved as Doc1.doc, ~$Doc1.doc temporary file
is created. SaveAs is performed on the Doc1.doc, saving as Doc2.doc, creating
the ~$Doc2.doc as I would expect, however the Doc1.doc and ~$Doc1.doc are
also still showing, and you are unable to deleted Doc1.doc because it is
still 'held'. Closing Doc2.doc then allows you delete. This is all performed
using the standard SaveAs method on the Word object.

As always this does not happen on the development machine, but does on live
machines. Additionally I can 'occasionally' get Word to do the same thing
manually, ie using File, SaveAs, but it is not consistant.

Any ideas?, Thanks OB
 
O

omega-bureau

Thanks for the reply.

The problem is Word *should* close and unlock the original file that you
preformed the saveas on. Because the act of saving as is that you are
creating a new document from the existing and then editing that new document.

However what is happening is Word is closing the document (it does not
appear in word, and within the documents collection) but it still has a lock
on the physical file. The only way of deleting the file is to close down the
'saveas' file.

It works correctly on development machines and a select few other machines,
but the rest exhibit this behavour. Therefore I am guessing it is either
something specific with these machines, but having looked versions of word,
service packs, etc are the same. Additionally it was working, and now does
not.

go figure!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top