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 SO 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:
Dim XLApp As Application = New Application()
Dim XLWkb as Workbook = XLApp.Workbooks.Open("TestExcel.xlsx")
Dim XLSht as WorkSheet = XLWkb.Sheet(1)
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
HRESULT: 0x80010105 (RPC_E_SERVERFAULT)
The solution to resolve this exception upon calling the 'Open' method on the Excel application is to set Excel application to be visible, i.e.
Dim XLApp As Application = New Application() XLApp.Visible = True
Don't ask me why, cuz I don't know, anybody who can enlighten me, please do so.