Wich activity could find a message box as a result of a macro

Hello!, i have a question please. Im trying to automate a macro execution, i have tried excel activities but it seems that errors will appear eventually (i got system.object type of errors and i have seen in the forum people complaining about this errors), so i have decided to run the macro without excel activities.

  1. SendHotkey to call Run Comand
  2. Type into to open excel
  3. SendHotkey again to call a macro
  4. Detect when a macro is finished, it has a message box (THIS IS THE QUESTION I HAVE)

The problem is that i want to detect when the macro is finished, sometimes it takes 7 min, 10 min or 15, it depends of the element automated.

I used the ON element appear activity with 900 000 miliseconds of timeout , but i have problems with this.
The settings are:
Timeout: 900 000 milliseconds
Wait for ready: Complete
Repeatforever: False
WaitActive: Check
WaitVisible: Check

If somone knows a better approach to solve this problem the advice will be welcomed. Thanks

You can either use a check app state and set the maximum desired time that you want to wait or use a loop to run for a determined time and use inside it the check app state.

If can also use the element exists if you prefer the classic activities and it works the same way.

If you want to use a loop, the condition must be to wait the result to be true or the iteration to be more times than you wanted (if you use 30 seconds and want to wait 10 minutes, you can set the counter maximum to 20 and in the activity the time must be 30).

Only remember that classic activities use time as miliseconds and modern activities use time as seconds :slight_smile:


As suggested you can use check app stte in modern and element exists in classic…as per acreenshot i can see you are usingn classic

Also can you share the errors…are the macro settings enabled…ideally its good to run macro from backend rather than doing ui automation on excel

You also have option to use invoke vba and save the macro in text file and run it


Thank you very much @uKisuke and @Anil_G. Indeed, i am new in UiPath and i am using old activities that i have watched in tutorials, I will try the modern activities and come back with a feedback.


I have tried the suggestion propossed and the process runs the macro but it doesnt find the button of the message box that appears when finishing the macro.
In the image below is the subprocess (N.1 and N.2). N.3 Shows the button selection and N4. The error.

Some details of the macro are:

  1. It is used to clean and order large data in multiple sheets, so the screen keeps updating
  2. After the data is cleaned it opens other excel file to load the data to a master table and close the file.
  3. The message box appears in the first file where the macro runs (not the master excel file).
    Any suggestion how to run a large and complex macro without problems and also i would like to run it by a bot. Thank you


Please remove any message boxes…I believe they are not needed…instead padd out arguments from macro if you want to collect some data


The problem is that i need to add another activity after the macro is finished, and ui path tells me it doesnt find the interface, so the message box was the indicator for finishing the macro


Then please remove the msg box…if the macro completes only then UiPath would move to next step

Include on error got to get the errors also to UiPath if it fails else a success message

Function Example()

    Example = "Success"
    Exit function
    Example = Err.Description
End function

In UiPath in out arguments for macro you would get the return value