How to catch error about vba

when i userd call macro activity ,sometimes that vba would occur errors,like can not open a wrong path of file,vba would show a warning window :can not open xxx,pls check if exists。。。the question is :UIpath‘s try catch can not deal with this case,so that job would waste much time,is there any UIpath master can help me,thx a lot!!!

You should handle errors in VBA code. Capture errors properly and you could also write the error message in a cell so that UiPath can read the cell value and log the error.

you mean i should use like try catch function in my vba? if so ,i would like to try ,thx a lot

We had to deal with a similar issue, when using existing VBA code written for humans. Errors in VBA don’t cause the UiPath activity to timeout, so we had to figure a different solution.

We introduced a new function in the VBA, that will only call the existing function we want to use. The function has a try-catch in it, and will tell with a boolean if the function succeeded or not (this boolean can be interpreted in UiPath, throw an error etc.). It’s easy to extend the outputs of such a function to contain a feedback message, such as passing out the error message, too.

1 Like

What would be the suggestions for improvement here, as far as the Invoke VBScript activity is concerned?
(is it the right activity I have in mind?)

This is a problem with all external codes. Ideally UiPath should have a feature to identify anything wrong with an external script or app invoked. However, I don’t think this is possible. Maybe it can be done for some apps like Excel VBA. A parallel thread that monitors the running of external script which can identify VBA error windows.

In any automation solution, if you are invoking external codes / apps, the external code / apps should handle all errors.