How to handle error vba (on uipath)?

I want to handle error vba code in uipath.
If popup vba show error , I want to close excel.

Please guide me about it.


In that case surround that activity where you run the VBA code with a TRY CATCH block

Right click that specific activity and choose Surround by Try Catch

And. In the catch block choose the exception type as System.Exception

And inside the catch block use a KILL PROCESS activity where mention the ProcessName as “Excel”

Cheers @fairymemay

@Palaniyappan As I know , If show popup as below.


Uipath can’t go to CATCH because it’s think working excel now.


There is no direct way to handle the external script errors
May be we can do it in this way

Use a element exists activity and look for any of the button in this pop up as a element
And get the output as a Boolean variable named bool_exists

Now use a IF condition like this

NOT bool_exists

If true it goes to THEN block where use a KILL PROCESS activity and mention “Excel” in ProcessName property

Cheers @fairymemay