Cannot delete xlsx file attached to mail, because it is being used by another process


I have a problem with deleting the excel file after I use it as an attachment to the Send Outlook Mail Message activity.

It says, Delete: The process cannot access the file ‘C:\file.xlsx’ because it is being used by another process.

I tried using Kill Process activity before the Delete activity for both EXCEL.EXE and OUTLOOK.EXE. It didn’t work out. I also tried putting some Delay before and after them, no way.

Any ideas will be appreciated.

Hi Have you open this excel in Excel Application Scope before you send the mail or particular excel which you try to delete can be opened in the background check in the Task Manager in Details Tab.


You might want to search for the lock (manually or automate it). You’ll find a link below with an approach.

I’ll avoid writing a file directly into C: drive too.

EDIT: take a look at the second answer here: filesystems - Find out which process is locking a file or folder in Windows - Super User

Thanks guys for your suggestions. Both of your suggestions may also help others who have a similar issue.

For my case, I figured out that Delete activitiy is inside the Excel Application Scope. When I dragged it one step out of that scope, it worked well!

Thanks for your support!



This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.