SaveAs Delete Problem

B

Brian

Hi,

I have seen many posts on this problem, but have not found an acceptable
solution...

I am automating word from VB and need to make changes to a document that I
cannot save. My code saves the changes to a new document using 'saveas'.
My problem is that this new file cannot be deleted until I close the word
application object.

I have tried to delete the file using the filesystem-object, the 'kill'
command and even in windows explorer to no avail. How can I get word to
remove its references to this document without closing down the application
object?

the essence of my code is this...

doc1.saveas "somenewfilepath.doc"
doc1.close false
doc2.application.selection.insertfile "somenewfilepath.doc"

kill "somenewfilepath.doc" 'this fails with permission denied error

TIA
-Brian
 

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