So, here’s the code in the XSLM file, Module1:
Sub CloneTemplate(strName As String) 'strName = "wubba" Sheets("EXAMPLE").Select Sheets("EXAMPLE").Copy After:=Sheets(Sheets.Count) Sheets("EXAMPLE (2)").Select Sheets("EXAMPLE (2)").Name = strName End Sub
Here’s the activity in my XAML:
Here’s the error:
Source: Execute macro
Message: The range does not exist Exception Type: ExcelException UiPath.Excel.ExcelException: The range does not exist ---> System.Runtime.InteropServices.COMException: Cannot run the macro 'CloneTemplate("Alberts, Joseph")'. The macro may not be available in this workbook or all macros may be disabled.
Note that when first testing this, the macro did not have the parameter, strName was hardcoded, and the Execute Macro called, simply, “CloneTemplate”. THIS WORKED! As soon as I added the argument to the macro and tried to execute the macro using it, that’s when the fun began.
Most vexing. Really hoping someone can offer a suggestion.