Hi guys,
what is your best solution to check if a file is ready to work with? For example: I modify an excel file. After that I’d like to copy and rename the file. Sometimes the time between closing the excel, copy and rename is too short (because of the excel size) and I am facing “cant access the file because it’s used by antoher process”
Greatful for any leads!
Regards
Marco
ppr
(Peter Preuss)
June 10, 2024, 11:17am
2
we would suggest to check if there is still a file handler pointing to the Excel and waiting till it is free again
Hi Peter,
thanks!
Something like:
While (Condition: fileIsOpen = False)
Try
Excel Application Scope / Rename / Move File
Assign (fileIsOpen = True)
Catch (Exception: System.IO.IOException)
Delay (Duration: 00:00:05)
?
Regards Marco
mkankatala
(Mahesh Kankatala)
June 10, 2024, 12:30pm
4
Hi @marco.roensch
After copy and pasting activites use the Kill process activity to kill the Excel Process.
Then use the further activities to work with the same excel.
Hope it helps!!
ppr
(Peter Preuss)
June 10, 2024, 12:41pm
5
we have a different approach in mind
File Handler in terms of pointers to a file from a process
We keep in mind that there is a delay between killing a Process and the HasExited Flag is swapping to true
But you can also try / check is Excel Process Checking could be an approach
Hi @marco.roensch
once you modified and save the excel file, try to use kill process ( Excel application) activity.
Hope it helps!!!
system
(system)
Closed
June 13, 2024, 1:19pm
8
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.