UiPath - issue - "Make sure Excel is installed.the QueryInterface call on the COM component for the interface with IID '{000208D5-0000-0000-C000-000000000046}' failed due to the following error: In "

【问题描述】

在 UiPath (2019.3.0 Community Edition) 使用 Excel Application Scope + Read Cell 读取 Exce l时报错

这个问题从 4/8/2019 17:47 起,到今天 4/15/2019 17:06,困扰了我一周,终于解决了!

下图是 Designer panel 的 workflow 和 异常截图

 

以下是详细的报错信息:

19.3.0+Branch.master.Sha.5fdb43627d7d3c011018bb545ddf9470210d44a9

Source: Excel Application Scope

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

Exception Type: System.Exception

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.Exception: Error opening workbook. Make sure Excel is installed. ----> 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: Interface not registered (Exception from HRESULT: 0x80040155).
   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 ExceptionDetail stack trace ---
   at UiPath.Excel.WorkbookApplication.StartNewApplication()
   at UiPath.Excel.WorkbookApplication.InitializeExcelApp()
   at UiPath.Excel.Activities.ExcelApplicationScope.<>c.<.ctor>b__44_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)

 

问题关键点:

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: Interface not registered (Exception from HRESULT: 0x80040155).

 


 

 【解决方法】

可能的原因(不太确定):

 之前电脑里安装了一个 32位的 Visio,但是安装的 office 365 是 64位的,引起注册表冲突

 

尝试过,但不好用的解决方法:

  • 删除32位的 Visio,然后在Programs and Features - Office 365 - Change (联网) 修复 Office 365,重启 

 

 最终解决方法,请依次操作下方链接的内容:

0x80040155 - Interface not Registered

Fix the Interface

Fix the TypeLib

Ensure MSOUTL.LIB is Registered (regtlibv12.exe "C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE")

p.s  上边文章中出现的 {00062FFF-0000-0000-C000-000000000046} 是 Outlook 的,如果你和我一样遇到的是 Excel 的问题,只需要将其换成 {00020813-0000-0000-C000-000000000046} 即可


 

【曲线救国的方法】

 Excel Application Scope + Read Cell 的搭配是需要安装 Excel 软件的(当然啦,上边的 Issue 就是在安装了Excel的情况下还是出现问题了),如果嫌解决起来太麻烦,还有另外一个曲线救国的方法,就是使用不需要安装 Excel 的 Read Cell 的 activity (这个方法无论如何都不会报错),请注意,虽然这两个方法都叫 Read Cell,但所属的包是不一样


 

参考

https://github.com/phw198/OutlookGoogleCalendarSync/issues/220

https://forum.uipath.com/t/uipath-dont-seem-to-recognize-excel-on-my-computer/102882 

posted @ 2019-04-15 17:35  coco1989  阅读(2535)  评论(0编辑  收藏  举报