Execute Macro from Personal Macro Workbook

Hi all,

I am trying to use the Execute Macro activity to run a macro from my Personal Macro Workbook (PERSONAL.XLSB), but I encounter an exception, which I’ve included below.

My input field for Execute Macro is as follows, where “JobsheetExport” is the macro name:

“C:\Users\Daniel\AppData\Roaming\Microsoft\Excel\XLSTART\PERSONAL.XLSB!JobsheetExport”

Here’s part of the error message (if the full message helps, I can post that too):

Message: The range does not exist
Source: Execute macro
Exception Type: ExcelException
UiPath.Excel.ExcelException: The range does not exist —> System.Runtime.InteropServices.COMException: Cannot run the macro ‘C:\Users\Daniel\AppData\Roaming\Microsoft\Excel\XLSTART\PERSONAL.XLSB!JobsheetExport’. The macro may not be available in this workbook or all macros may be disabled.

Any advice would be appreciated!

Regards,
Dan

1 Like

Put single quotes before C and ! in file path. The file path should be “‘C:\Users\Daniel\AppData\Roaming\Microsoft\Excel\XLSTART\PERSONAL.XLSB’!JobsheetExport”

7 Likes

Hi Rohit,

That did the trick, worked perfectly! Thank you. :slight_smile:

Dan

Hi All,

I am trying to use the Execute Macro activity to run a macro, but its showing error while run as:
“The range does not exists.”

I use excel application scope in which I browse file in which micro created.
and then use execute micro in which I give macro name.

Regards,
Amol

Hi @AmolS

You may have solved this already, but if not, can you attach the workflow you are using, or a screenshot of the Execute Macro activity?

Regards,
Daniel

Thanks for your help.
Now its working and problem is resolved.

Thanks,
Amol

1 Like

it work :smiley:

Hi everybody

I’m trying to run an Excel macro in format XLSB too, with two variable arguments. I couldn’t find the way, to send these arguments to the macro, despite one argument is well sent.

Another issue I have, is that the macro execution is run twice, even we the macro contains just a message.

Does anybody knows, what can be wrong.

Macro execute activity:

AppData\Roaming\Microsoft\Excel\XLSTART\PERSONAL.XLSB’!Formato_original_activar(" + Code.ToString + ", " + variable.ToString + “)”

Public Function Formato_original_activar(code As String, variable As String)

MsgBox code

MsgBox variable

End function

Many thanks

1 Like

Has this issue been resolved? Having similar problems with the macro being called twice despite it only being coded once

Hi everybody,

I need help pleas,

I have 4 macros in my excel file, i want to excute them all, i did it but i have an awkward error

Message : Exception de HRESULT : 0x800A9C68
Exception Type : ExcelException

UiPath.Excel.ExcelException: Exception de HRESULT : 0x800A9C68 —> System.Runtime.InteropServices.COMException: Exception de HRESULT : 0x800A9C68
at Microsoft.Office.Interop.Excel._Application.Run(Object Macro, Object Arg1, Object Arg2, Object Arg3, Object Arg4, Object Arg5, Object Arg6, Object Arg7, Object Arg8, Object Arg9, Object Arg10, Object Arg11, Object Arg12, Object Arg13, Object Arg14, Object Arg15, Object Arg16, Object Arg17, Object Arg18, Object Arg19, Object Arg20, Object Arg21, Object Arg22, Object Arg23, Object Arg24, Object Arg25, Object Arg26, Object Arg27, Object Arg28, Object Arg29, Object Arg30)
at UiPath.Excel.WorkbookApplication.RunMacro(String macroName)
— End of inner exception stack trace —
at UiPath.Excel.Activities.ExecuteMacro.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager).

thank you very in advance !

Hi

To avoid exception like : HRESULT, we need to change trust center settings for that excel.

Hi,

I am trying to run a macro from UiPath. However, I am getting an error saying ’ The range does not exist’. In the excel scope, I have given the workbook name and then within that an execute macro function with the macro name in quotes (“Macro1”). Thanks for your help.

1 Like

“C:\Users\Daniel\AppData\Roaming\Microsoft\Excel\XLSTART\PERSONAL.XLSB!JobsheetExport”

it works