Execute Macro error

Hello.
I am having an error of using execute macro activity.
Although the macro itself works well, an error comes out when I use to execute macro from uipath.
Please Help me.
Thank you…

Hi @hsupyaewoon

Could you please share the error message or your workflow that error occurred.

1 Like

Hello @Natapong
Thank you for your reply.
The error is like this.
image

1.Please check your Trust Center.

2.Please check your macro code have something like workbook.close or wb.close
(command for close your workbook), try to comment out or remove it.

Please refer as below:

I hope this information will be useful for you :smiling_face_with_three_hearts:

1 Like

@Natapong
Thank you for your answer.
For the suggestion 1, I checked disable all macros with notification for security.
For no 2, i don’t really understand what it means… :"(
I have only one macro and i saw nothing similar like wb.close() or excel.quit().

@hsupyaewoon

If your marco code don’t have command to close workbook that it ok.

Please try to check Enable all macros for test run excute macro activity.
I want to confirm the macro settings, is it a cause of your problem?

1 Like

@Natapong
Here is my error message got from excel macro.
image

@Natapong
No it doesn’t have any command to close workbook.
Sure. I will try with it.

@Natapong
I did it.

But got the same error.

@hsupyaewoon

Could you please share the capture screen of your workflow.

1 Like

Hello @Natapong
Sorry for late reply.
Here is my workflow.

Hi @hsupyaewoon

Please try to run your workflow by Debug mode and set breakpoint on your Execute marco activity.
After workflow stop at breakpoint, please try to run your macro by click run marco in your Excel.
*I want to confirm your marco can run correctly after Append Range ?

1 Like

@Natapong
Ok. I will try to run my macro by clicking the run button in excel.

Hello @Natapong
I did it.
The macro runs correctly after Append Range.
I ran it by clicking the button in my excel.
But I am not sure what do you mean by to set breakpoint.
I just deleted the execute macro activity for a while.

@hsupyaewoon

->set breakpoint for stop workflow and test run marco.
It same with deleted the execute macro activity and run marco after run workflow finished

I would like to test run your marco code by using Invoke VBA activity.
1.Copy your marco code and paste it to Text editor(notepad etc)
2.Save it to .vbs file
3.Put Invoke VBA activity to your workflow (inside Excel application scope)
4.Try to run workflow

For emergency solution, Please try to use click activity to click run macro on your excel file.
Click Develiper tab > Click Macros menu > Click Run button
*Don’t forget to use wildcard in your selector.

1 Like

@lakshman , @Palaniyappan , @Lahiru.Fernando and everybody

Could you please help me to find solution for this error.

When hsupyaewoon run Execute Macro activity, system show error message
image

If run Marco by click run on Excel file,then it working well.

1 Like

Hi , is the Macro name correct ?
“Main” is the default name for Macro
Are you using the same name for creating the macro ?

1 Like

Hello @Natapong
Thank you so much for your reply.
And really sorry for being late.
I have tried “invoke macro” and this error came out.
image
Really appreciate for your help.
Thank you so much…

Hello @vinay_reddy
Thank you for your reply.
I used different name in macro.
Do I need to use the default name?

Hi @hsupyaewoon

Please try to checked [Enable all macros] and [Trust access to the VBA project] and run your workflow again.

1 Like