Issues in Invoke VBA

Handling errors and exceptions that occur within Excel VBA code invoked from UiPath are challenging in some scenarios. When an error occurs in VBA code, it can potentially lead to a situation where the UiPath process gets stuck, we were able to handle this in our projects using exception handling in vba itself and then validating result variable from UiPath.

Are there any other straight forward ways to handle this?

If not is it possible to handle this automatically like using some
Error Propagation and Detection? Introduce a mechanism for error propagation from the invoked VBA script back to UiPath. So that it can be handled using exception handling in UiPath

Hi @Athira ,
you can try use Try catch with exception

UiPath won’t throw exception if some error is thrown inside invoke vba code. That’s why i was asking if there is any alternative approach other than to handle from vba script itself. I was just asking since UiPath is now adding features which provide almost a no code platform, we can may be record excel macros and directly use it without adding vba exception handling mechanism.

I see a lot of topics same this but not have answer :frowning:
VBA has a concept of on Error statement and handling. correct
hope it help

1 Like

Thanks for the reply. As i mentioned in the post i was able to handle these issues using vba exception handling, but yes as you said was seeing many posts with no proper answers. So i thought may be everyone can put their thoughts here or any different approach available

Thank you for sharing this. In this case, would you be interested in potentially controlling the runtime when a VBA script errors? i.e. maybe terminate, skip, retry etc.

Yeah I will prefer to handle like any other exception/error

Thank you for the additional context.