ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Deleting file while in use (https://www.excelbanter.com/excel-programming/296763-deleting-file-while-use.html)

Todd huttenstine

Deleting file while in use
 
Hey guys

The Excel file I am trying to delete is the same file that
the code is in.
I know it is impossible to delete or overwrite an Excel
file that is in use by Excel. But is there anyway that
after Excel quits, it can delete itself?


Thanx
Todd Huttenstine

Tom Ogilvy

Deleting file while in use
 
Look at the
ChangeFileAccess
method. Have your code change it to readonly , then try to delete it.

I haven't tested it, but it might work.

--
Regards,
Tom Ogilvy

"Todd Huttenstine" wrote in message
...
Hey guys

The Excel file I am trying to delete is the same file that
the code is in.
I know it is impossible to delete or overwrite an Excel
file that is in use by Excel. But is there anyway that
after Excel quits, it can delete itself?


Thanx
Todd Huttenstine





All times are GMT +1. The time now is 10:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com