Workbooks.Open method throwing HRESULT: 0x800A03EC

亡梦爱人 提交于 2019-12-24 12:34:39

问题


I am opening an excel file using

 object missing = Type.Missing;

xlWorkBook = xlApp.Workbooks.Open(strFilePath, missing, false, missing, missing, missing,
true, missing, missing, missing, missing, true, missing, missing, missing);

and it throws HRESULT: 0x800A03EC

It was working fine with office 2010 but after updating office libraries to version 15 and when deployed to server which had office 2013. I started getting this message. I have also tried giving permission to Excel Object in DomConfig but it didn't worked,,


回答1:


note that there are many versions of Microsoft.Office.Interop.Excel.dll
for me, I can find one in:

C:\Program Files\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\PIA\Office14


and another one in:

C:\Program Files\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\PIA\Office12


remove references from your project and add the suitable ones, rebuild your solution.
EDIT #1
Office11 is the internal name for Office 2003.
Office12 that for Office 2007.
Office14 that for Office 2010.
When Installing Microsoft Office, make sure that the .NET Programmability Support feature is selected. Also, you can download them form :
Office 2010: Primary Interop Assemblies
try to find those for Office 2013 .




回答2:


It doesn't matter what version of Office PIAs you are using at the moment because even with old PIAs your code should work against the newest Office versions.

Instead, take a look a look at the Considerations for server-side Automation of Office article which states the following:

Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.



来源:https://stackoverflow.com/questions/27706258/workbooks-open-method-throwing-hresult-0x800a03ec

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!