Delete Activity Error

uiautomation
studio

#1

Hello All,

I’m trying to perform below action :

From a directory that contains multiple folders, I’m opening text file with excel from each folder, changing the content of excel, saving back it into same text format and compressing each folder.

In the end I’m cleaning up the folders in the directory. While performing this action i’m getting error as : the process cannot access the file because it is being used by another process. Can anyone help me on this.


#2

Hi Manjusha,

Please check the solution in this topic:


#3

I’m opening the text file using processStart = System.Diagnostics.Process.Start(“EXCEL.Exe”, File.ToString). When I’m commenting this portion of code, The files are getting deleted properly. I suspect there is some issue cleaning the files which I’m opening using processStart. Do I need to kill the process after I’m opening text file with processStart.


#4

I’m thinking yes. It seems to remain open somehow and that’s why yo get the error. So close it before delete.


#5

Hi Ovi,

I’m closing the saved excel by giving alt + f4 and when I tried to kill the process, its throwing the error that process has exited.


#6

Have you tried with Invoke method like in the example in the topic above?


#7

Should I add this before cleaning up directories?Capture