Open Excel 2016 file failed with HRESULT: 0x800706BE

3

The simple VB.NET code for opening up an existing Excel file consistently failed at open command with the following error:

The remote procedure call failed. (Exception from HRESULT: 0x800706BE)

I've searched Stack Overflow and Microsoft sites for this error, it looks like no one has a definitive answer. But one thing consistent seems to be all happens with 64bit Excel.

Anyway, I am here asking for help with this problem. Below is my very simple code:

Imports Microsoft.Office.Interop.Excel
Dim XLApp As Application = New Application()
Dim XLWkb as Workbook = XLApp.Workbooks.Open("TestExcel.xlsx")
Dim XLSht as WorkSheet = XLWkb.Sheet(1)
XLWkb.Close()
XLApp.Quit()
System.Runtime.InteropServices.Marshal.ReleaseComObject(XLSht)
System.Runtime.InteropServices.Marshal.ReleaseComObject(XLWkb)
System.Runtime.InteropServices.Marshal.ReleaseComObject(XLApp)

The above code kept failing at the XLApp.Workbooks.Open line with that dreadful message.

My windows is Windows 7 Enterprise Service Pack 1, 64-bit
My Excel is 2016 MSO (16.0.6701.1041) 64-bit version.
My MS Office is MS Office 365 ProPlus -en US (2016 version)
My VS is Visual Studio Community 2015 Version 14.0.24720.00 Update 1
Visual Basic 2015 00322-20000-00000-AA181
My project has the following references:

   Microsoft.Office.Core: Microsoft Office 16.0 Object Library
   Microsoft.Office.Interop.Excel : Microsoft Excel 16.0 Object Library
   VBIDE : Microsoft Visual Basic for Applications Extensibility 5.3

Also, I've tried putting the Excel file in my C:\Users personal folder, also tried to use 'CreateObject("Excel.Application")' to create the Excel application, all failed with the same error message upon 'Open' call.

Ok, I also tried this same program on a different Windows 7 Professional 64bit computer, with MS Office 2007 (hence, Microsoft Excel 12.0 Object library etc.), compiled to x86, it also failed at the 'Open' call. But with another common error: HRESULT: 0x80010105 (RPC_E_SERVERFAULT), which has been posted by many other developers.

Then, I tried this same program on a Windows 8 machine and compile to x86 with Office 2007 and it worked just fine.

So, at this point, I think this is a Microsoft Windows 7 bug with the Microsoft.Office.Interop.Excel; so, I am giving up on trying further and switch to dev on Windows version other than 7.

Any insight would be appreciated.

excel
vb.net
64-bit
hresult
asked on Stack Overflow Oct 21, 2016 by For Comment • edited May 18, 2017 by Bugs

2 Answers

5

The solution to resolve this exception upon calling the 'Open' method on the Excel application is to set Excel application to be visible:

Dim XLApp As Application = New Application()
XLApp.Visible = True

Don't ask me why, because I don't know, anybody who can enlighten me, please do so.

answered on Stack Overflow Oct 22, 2016 by For Comment • edited May 18, 2017 by Bugs
0

You need to disable "FoxitReader PDF Creator COM Add-in" for Excel. It works for me. Source

answered on Stack Overflow Mar 10, 2020 by Mikhail

User contributions licensed under CC BY-SA 3.0