Issue with File Command on Excel

Hi EasyMorph Team,

when executing a "Delete File" file command on an Excel File, an error message pops up indicating that the file is being used. However, I am running the powershell command "taskkill /F /IM excel.exe" right before the File Command.

Do you have any idea of what I could do do mitigate the error message?

Thanks in advance!
Albert

Hi Albert,

Try adding a delay (the "Wait" action) for a few seconds before deleting the file.

Hi Dmitry,

I put the wait action in. It solved the issue mentioned above. However it doesn´t solve the "Exception from HRESULT: 0x800AC472" error on the Excel Command.

Do you have any idea of what I could or should be doing? I'm thinking about using Powershell, instead of the EM action. But it's much less elegant.

What does comment the "Excel command" action do?

EasyMorph uses the same .NET classes under the hood as PowerShell. If the action throws the error, most probably PowerShell will also throw the same error.

image

It does a re-save. Could it be the environment then? Maybe something with the Excel configuration, or the Windows machine?

Make sure that Excel command is only executed once at a time with one file at a time. COM-automation doesn't like simultaneous operations.

Give it a few seconds delay before and after the operation. COM-automation isn't entirely synchronous.