Deleting DOC file in Shutdown Event

C

Chuck Hartman

I have created a VSTO 2005 Word project that opens a remote read-only
document. The Open Event handler does a SaveAs of the current document to a
local temporary folder to allow the user to make changes to the document.
When the user finishes with their changes, they use an Actions Pane button
to save the document and post it back to the server. This all works well
without any problems.

For security reasons, I would like to clean up all of the temporary
resources created by my project, which among other things includes the DOC
file saved during the Open Event handler. However, even if I wait until the
VSTO Shutdown event, which occurs after the Close event, I am unable to
delete the file because it is still locked by Word. Is there a way to get
Word to unlock the file so it can be deleted, or is there some other way to
get rid of that file? Thanks.

This doesn't seem to be a VSTO specific question, so I am posting here.
Please let me know if there is a more appropriate group.

Chuck Hartman
 
P

Peter Huang [MSFT]

Hi,

Based on my research, when the ShutDown event fire, the doc file is still
holded by the Winword.exe process.
So we will get error when we attempt to delete the file.
Also there is an VSTO specific group, you may try to post there there will
be more VSTO experts there.
microsoft.public.vsnet.vstools.office

Thanks for your understanding!


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

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