Execute Macro from Personal Macro Workbook

excel
activities
macro

#1

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


Open an excel and execute a macro
How to run "Execute Macro" activity?
How to execute macro of other workbook in the present workbook, during automation
Excel error - While writing the range
#2

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”


How to use execute Macro
#3

Hi Rohit,

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

Dan


#4

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


#5

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


#6

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

Thanks,
Amol


#7

it work :smiley:


#8

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


#9

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


#10

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 !


#11

Hi

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


#12

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.


#13

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

it works