File being used by another process

After I run my process a number of times I keep getting this error. I am using a Write Range Workbook not using an Excel scope. I check task manager to see if Excel is running in background but it is not. The repeat cycle is long so there is plenty of time to release. I am doing this for my project so I want to use the “background” operation method before I do a workaround. I’ve had file issues before where I had to use a delay before reading a CSV after writing because it couldn’t find the file.

image

Hi AlienV,
To resolve this error, put everything under an Excel application scope. Otherwise you will keep getting this error.

Thanks,
Kunal

@AlienV

can you share your XAML file.
if you kept in loop and killing process then there should not be any issue.
i also want to check how big is your datatable?
the reasons for the error is not only Excel process there are other possible reasons are like
case 1 - while upload
case -2 - copy or move
etc…