Unable to Throw Exception during Excel Macro execution

I’m currently trying to execute a printing macro within an excel scope, inside a parallel.
If the macro takes longer than expected, I want to forcefully throw an error so that the flow can continue.
I’ve inserted a 1min wait into the Macro to test the scenario, and the Delay on the right side in the parallel is set to 10 sec. After 10 sec the flow goes on to execute the Throw, the problem is that it stops there and waits for the macro to finish the execution. If it’s only the 1min it as to wait for, it’s fine, but if en unexpected error occurs that makes the Macro stop, then the whole flow will stop, which is what I want to prevent.

Is this waiting function a default in Execute Macro or is there some way to fix this?

CompleteCondition in Parallel is set to True. ContinueOnError in Execute Macro is blank.
I also tried invoking the Macro execution, without any result.

Thank you.



I have tried something, check if it helps you in any way.
What i did is:

  1. Created a workflow “Delay.xaml” with a delay activity of 20 seconds in it.
  2. Load and invoke workflow activity have timeout property so, i invoked "Delay.xaml"
    with timeout property set to 10 seconds. It throws exception if invoked flow doesn’t get executed within Timeout provided.
  3. As delay requires atleast 20 sec to execute because of delay activity it’s throwing exception and works fine if i reduce the delay.

Please find workflow attached.Timeout.zip (3.2 KB)

You can try to use this method. Just execute your macro in a separate workflow file and set timeout for load and invoke workflow to 10 seconds.
It will throw exception if macro takes more than 10 sec to complete.

Thank you so much for your answer! I had no idea there were such an activity.

Unfortunately, after copying your workflow and inserting the macro workflow instead of the delay, I get an exception that the path is null.
I’ve tried both inputting the full file path and only the name of the xaml file, but both generates an exception. I can’t really find any info on the load and invoke workflow activity, so i’m unsure of what’s wrong.

I apologize that I cannot share my workflow. I’m on a computer without internet that due to security reasons doesn’t allow me to send files.

Thank you

This i my invoked Macro workflow

I have also checked there’s not any description available for this activity.

Can you check the source of your exception as i can see your path value is not null but still you are getting path null exception. If path is a problem then it should throw exception Cannot find\invalid path or something like that.

It’s working fine on my machine, I have also replaced delay activity with a sample macro execution, you can check workflow attached.Timeout.zip (14.3 KB)

Make sure your workflow path is correct, you can verify by using it in invoke workflow file activity weather it’s invoking the target xaml or not.
Btw how you are getting the excel path in your invoked workflow as i can see a variable named copiedResultFile as exception may be due to any other unknown reason.

1 Like

Thank you again for your prompt reply.

I checked the macro workflow file path by doing a normal invoke. It runs fine, so that excludes any problems with the file path.
I also tried executing your exact workflow on another computer that has access to internet and also
has a newer version of UiPath (1.4 instead of 1.2 as on my other machine), but i get this error message;

I searched this on the internet too, but couldn’t find anything explicit that tells me the reason for the exception.

The excel path is decided by reading an excel file cell and copying the file, in the main workflow at the beginning of the main execution. The file path is put into the variable “copiedResultFile”.

I realized one thing though, when invoking the Excel file and executing it normally, I have to import the argument “CopiedResultFile”, which I cannot explicitly do when using the “Load And Invoke Workflow” activity. Might this cause an error?

On the other hand, I added a breakpoint inside the invoked macro workflow, debugged to see if it actually went to the Macro Execution, which it doesn’t. It stops when trying to execute the Load And Invoke Workflow activity and throws an Exception of the type mentioned before.

I cannot see what the problem might be.

Hello @Tussan_Steding, @Bharat,

I happen to encounter the same error too “Cannot create unknown type…” , googled it and found an article I think must be leading to the answer to this issue but I don’t know how to implement that in UiPath.


Could anyone kindly suggest what to try?


I found a solution for this (finally…), in case somebody is still struggling with this. Please check workflow below, hope it is clear enough.

Everything inside try catch:

  1. Assign excelMacroStatus = False
  2. Run in paraller :
    2.1) Execution of macro and after that assign excelMacroStatus = True (if macro is on error, this variable will not get True status)
    2.2) Delay for 30sec. Then IF excelMacroStatus = False Then loop thru all process and stop Excels. You can also have couple of IF activity, if you want to wait more.

This works out for me without any errors.

Regards, Thomas