UiPath Academy Code returns error - Make sure excel is installed error

Hello, when I run my code, the first activity is to open an excel file and I get an error. I have not made any changes to the code since the last time I ran the bot and now I get an error with the message below:

Since I did not make any changes I decided to run a test file from UiPath Academy (Book Sales Report from the Excel Automation with StudioX course) and this gives me the same error as the first activity is also to open an excel file. This makes me believe there is an issue with my UiPath or Excel system rather than code. Can anyone advise on next steps to fix this?

Error opening workbook. Make sure Excel is installed. Unable to cast COM object of type ‘Microsoft.Office.Interop.Excel.ApplicationClass’ to interface type ‘Microsoft.Office.Interop.Excel._Application’. This operation failed because the QueryInterface call on the COM component for the interface with IID ‘{000208D5-0000-0000-C000-000000000046}’ failed due to the following error: Element not found. (Exception from HRESULT: 0x8002802B (TYPE_E_ELEMENTNOTFOUND)).

image

Hi @bot82,
Which version of excel do you have?

Hello, I am using Microsoft 365 for Enterprise, Version 2008 (Build 13127.21064)

@AndrewHall please take a look. Possible bug?

@bot82 This is usually caused by a bug in the installer for Microsoft Office where it leaves Excel unregistered with Windows such that it can’t be found by automation applications (basically UiPath dials Excel’s phone number, and Windows connects the call, this bug causes Excel to forget to register with Windows).

If you have StudioX 20.10 or newer, the fix is to run the Office Repair tool we’ve provided in the product Microsoft Office Issues.

If you aren’t on a 20.10 version, let me know and we can get you a standalone version.

1 Like

Hello, I am using StudioX 2020.4.3

You can download the zipped tool from Sign in to your account

Unzip, and run the “RunRepairTool.bat” to launch it. Note: You can generate a repair plan without admin rights, but applying the repair options will require administrative rights on the machine.

1 Like

Hello @AndrewHall I am using 2019.10.3 version. I tried the zipped tool but didn’t work. Below is my error code and looks exactly the same as bot82’s.

19.10.3+Branch.support-v2019.10.Sha.95df6905e4f3e6898cb391d1e7a7af2314bc8023

Source: Excel Application Scope

Message: Error opening workbook. Make sure Excel is installed.

Exception Type: System.Exception

RemoteException wrapping System.Exception: Error opening workbook. Make sure Excel is installed. —> RemoteException wrapping System.InvalidCastException: Unable to cast COM object of type ‘Microsoft.Office.Interop.Excel.ApplicationClass’ to interface type ‘Microsoft.Office.Interop.Excel._Application’. This operation failed because the QueryInterface call on the COM component for the interface with IID ‘{000208D5-0000-0000-C000-000000000046}’ failed due to the following error: Element not found. (Exception from HRESULT: 0x8002802B (TYPE_E_ELEMENTNOTFOUND)).
at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget, Boolean& pfNeedsRelease)
at Microsoft.Office.Interop.Excel.ApplicationClass.set_SheetsInNewWorkbook(Int32 RHS)
at UiPath.Excel.WorkbookApplication.StartNewApplication()
— End of inner exception stack trace —
at UiPath.Excel.WorkbookApplication.StartNewApplication()
at UiPath.Excel.WorkbookApplication.InitializeExcelApp()
at UiPath.Excel.Activities.ExcelApplicationScope.<>c.<.ctor>b__48_0(WorkbookArguments args)
at UiPath.Excel.Activities.ExcelApplicationScope.Execute(NativeActivityContext context)
at System.Activities.NativeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at UiPath.Executor.BaseRunner.EndExecute(IAsyncResult result)
at UiPath.Executor.InProcessRunner.EndExecute(IAsyncResult result)
at UiPath.Core.Activities.ExecutorInvokeActivity.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)

@Shuxian just to confirm, you opened the tool Generated the repair plan, and did “Run repair actions” which then requested admin privileges all from the Excel tab? I’m confirming as it’s easy to miss the “Run repair actions” step as just clicking “Generate repair plan” doesn’t make any changes on the machine.

@AndrewHall I clicked the run repair actions with “successful” message pop up. But still got the error code.

Please go to “Add or remove programs” in Windows and run a “Quick Repair” for your Office installation:

3 Likes

@flavius That works! Thank you very much :smiley:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.