Problems with Invoke VBA - RPC_E_SYS_CALL_FAILED

The attached workflow is meant to execute a VBA script on an Excel.

Exp_Distribution_Vba.xaml (41.6 KB)
This how the Excel looks like


The VBA script takes in two arguments, the row number where the activities begin and the row number where the activities in the VBA script end
The invoked VBA Script works perfectly fine when it works on a limited number of rows are involved, say 12 or 15. But when the start row number is something like 2 and the end row is 2464, the exceution errors out and the following exception is thrown:
Invoke VBA - DuplicateAndAdjustRows w args: System call failed. (0x80010100 (RPC_E_SYS_CALL_FAILED))
The stack trace is as follows:

UiPath.Excel.ExcelException: System call failed. (0x80010100 (RPC_E_SYS_CALL_FAILED)) —> System.Runtime.InteropServices.COMException: System call failed. (0x80010100 (RPC_E_SYS_CALL_FAILED)) at Microsoft.Office.Interop.Excel._Workbook.get_VBProject()
at UiPath.Excel.WorkbookApplication.InvokeVBA(String codeFilePath, String entryMethodName, IEnumerable1 entryMethodParams) at UiPath.Excel.Activities.Business.InvokeVBAX.InvokeVBAInternal(IWorkbookQuickHandle handle, String codeFilePath, String entryMethodname, IList1 arguments)
— End of inner exception stack trace —
at UiPath.Excel.Activities.Business.InvokeVBAX.InvokeVBAInternal(IWorkbookQuickHandle handle, String codeFilePath, String entryMethodname, IList1 arguments) at UiPath.Excel.Activities.Business.InvokeVBAX.ExecuteDoWork(ActivityContext context, ExecuteVBADescriptor descriptor) at UiPath.Shared.Activities.BaseParentActivityWithDescriptor2.OnCompleted(NativeActivityContext context, ActivityInstance _)
at System.Activities.Runtime.CompletionCallbackWrapper.CompletionWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
DuplicateAndAdjustRows.txt (2.3 KB)
Attached herewith is the VBA script as well, I didn’t think it necessary for me to go over the workings of the script, but let me know if you need to know it as well.

Kindly assist me on how to overcome the

System call failed. (0x80010100 (RPC_E_SYS_CALL_FAILED))

exception. Thank you.

  • Please let me know if you need more information

hi, @RobinsonFrancis Don’t process all rows at once. Break your job into smaller chunks try 200 at a time. Loop in UiPath and call VBA for each chunk. Seriously, this fixes most problems.

Make sure Excel isn’t already running crazy in the background. Kill every Excel process before starting the automation.
Always run Excel in visible mode so it doesn’t get disconnected in the background.
Save and close Excel after each chunk if you’re processing a really huge file, then reopen for the next lot.