
Unable to delete and Excel Workbook from VBA
I may be wrong but I think you can just close the Workbook without closing
Excel application and you should be able to delete the file.
If you close the Workbook and the delete the file straight away, you may
need to add the DoEvents statement to allow the O/S time to perform the
background tasks to actually release the lock on the Workbook.
HTH
Van T. Dinh
Quote:
> When I attempt to delete an excel workbook from VBA, using the VBA Kill
> command or the Scripting Runtime's FileSystemObject Object I get the
> following error.
> Run-time error '70':
> Permission denied
> I suspect that this is because excel has locked the file, thus preventing
it
> from being deleted.
> The only way to delete the file is by Quitting and Relaunching Excel.
> How can I make excel release the lock on the workbook file without
quitting
> excel or stopping the execution of the subroutine?