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

Hi,

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.
image

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.

Hello,
@Jenni_K

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.

https://gallery.technet.microsoft.com/How-to-find-out-which-c0d4e60e

EDIT: take a look at the second answer here: https://superuser.com/questions/117902/find-out-which-process-is-locking-a-file-or-folder-in-windows

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!

image

2 Likes

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