About exception handling occurred in ExcecuteMacro

Hi all,

I would like to catch an exception while executing a macro in “ExecuteMacro” of “UiPath.ExcelApplicationScope” if it occurs.

First of all, I want you to Run “Sample1”.
In this flow chart, OnElementAppear is placed on the left side in the Parallel activity, and the display of “Microsoft Visual Basic” is detected by OnElementAppearActivity.
If a robot find an element, click “End”.
Also, on the right side, “ExecuteMacro” is executed by “ExcelApplicationsScope”.
In this sample, exceptions are intentionally made to occur, so the exception is correctly caught.

Next, I want you to run “Sample2”.
In this sample, no exception occurs and a message “OK” is displayed.

Based on these, I would like to ask some questions.

(1)In “Sample2”, the “OK” message box does not appear immediately after macro execution is completed.
I think that it is because a robot waiting until OnElementAppear’s default seconds of TimeOutMS has passed, is there a way to display a message box immediately after the execution of the macro normally ends?

(2)In “Sample1”, at first glance it seems that exceptions are caught correctly.
However, if the processing of the macro does not end in 30 seconds, OnElementAppear does not work and stops while the debug screen is displayed.
Of course, setting the value of TimeOutMS long will solve once, but it always waits that time regardless of the success, very poor performance.

(3)Or can I set TimeOut on “ExecuteMacro” itself? For example, if Excel is open after 10 minutes, throw an exception.

Summarized as follows.

  • When an exception occurs in ExecuteMacro, click “End”.
  • Macro execution time takes about 15 minutes, but it varies depending on the situation.
  • I can not modify the macro itself so as not to pop up.

Please excuse my poor English…
Thanks in advance.

Samples.zip (28.5 KB)

It seems like you already use the try small talk, have you tried to use that activity ?

besides, I think this is the full purpose of automation, like if you have two macros, you need to evaluate the actual process, I know it becomes complicated when control chart comes into the picture…

anyway,…

what’s your native language ?

oh, you did use try catch, well… seems you use do while, activity… right… i know conditions tend to reproduce… but right now you can try to run the macro and catcht the exception and run the clik from there…

as a recomendation I suggest you to read the no object pattern. its in many languages…hahahah

best regards…!!!

here is the behavoir

Main.xaml (11.9 KB)