HRESULT: 0x80010105 (RPC_E_SERVERFAULT) when opening an Excel file from VB.NET
-
Friday, July 06, 2012 10:23 PM
Hi All,
I am getting an exception HRESULT: 0x80010105 (RPC_E_SERVERFAULT) when executing this code:
Dim xl As Excel.Applicationxl = New Excel.Application xl.Application.DisplayAlerts = False xl.DisplayAlerts = False xl.Workbooks.Open(fName)
The workbook can be opened manual without any problems. Also, this error happens ONLY on a few machines (Win XP, Office 2010). It works perfectly fine on other machines though.
I would appreciate your help as I have been trying to resolve it for a long time. Any suggestions?
Thanks!
- Edited by astro928 Friday, July 06, 2012 10:28 PM
- Edited by astro928 Friday, July 06, 2012 10:33 PM
- Moved by Cindy Meister MVPMVP Monday, July 09, 2012 7:25 AM Excel-specific question; not using VSTO technology (From:Visual Studio Tools for Office)
All Replies
-
Friday, July 06, 2012 10:40 PM
Where does your code run? Is it a GUI app, service ,etc.?
Do your app and Excel run in different security contexts (e.g. one of them is running with elevated privileges)?
Dmitry Streblechenko (MVP) http://www.dimastr.com/redemption
Redemption - what the Outlook
Object Model should have been
Version 5.3 is now available!
-
Friday, July 06, 2012 11:23 PM
Where does your code run? Is it a GUI app, service ,etc.?
Do your app and Excel run in different security contexts (e.g. one of them is running with elevated privileges)?
This code is a "launcher" of an Excel workbook, which contains a lot of VB code. The main point is that it throws an exception on the first line of opening the workbook, i.e.
xl.Workbooks.Open(fName)
The application doesn't require elevated privileges. -
Saturday, July 07, 2012 9:01 PMDo you launch the exe from Windows Explorer? Is Excel already running?
Dmitry Streblechenko (MVP) http://www.dimastr.com/redemption
Redemption - what the Outlook
Object Model should have been
Version 5.3 is now available!
-
Sunday, July 08, 2012 6:37 AM
Do you launch the exe from Windows Explorer? Is Excel already running?
Yes, it is launched either from explorer or a desktop shortcut to that.exe. Excel doesn't run before.
-
Sunday, July 08, 2012 7:22 AM
Hi astro928,
One of the common reasons of such failures on some machines could be the presence of different add-ins that might interfere in the Excel startup, and cause future API calls to return exceptions. Verifying the add-ins available, or disabling all add-in before you run your application might be a good troubleshooting step.
Also, if you try making the application visible (Application.Visible = true) before calling Workbooks.Open, do you notice anything like a dialog box?
Regards,
Manvir Singh
http://www.manvirsingh.net/ -
Monday, July 09, 2012 4:24 AM
This is not correct. When launching Excel applications via marshal interop, all Excel addins are disabled. In fact, you have to enable them manually from the .NET code. There are two ways of doing that - depending whether the addin is .xll or .xla type. In any case, Excel addins are irrelevant to that error, because they are all disabled.Hi astro928,
One of the common reasons of such failures on some machines could be the presence of different add-ins that might interfere in the Excel startup, and cause future API calls to return exceptions. Verifying the add-ins available, or disabling all add-in before you run your application might be a good troubleshooting step.
Also, if you try making the application visible (Application.Visible = true) before calling Workbooks.Open, do you notice anything like a dialog box?
Regards,
Manvir Singh
http://www.manvirsingh.net/ -
Thursday, July 12, 2012 7:01 AMModerator
Hi astro928,
Thanks for posting in the MSDN Forum.
Would you please comment "xl.DisplayAlerts = False"? In my opinion that is a duplicated statement.
Let's see whether that action can solve your issue.
Have a good day,
Tom
Tom Xu [MSFT]
MSDN Community Support | Feedback to us
-
Thursday, July 12, 2012 7:59 AM
Hi astro928,
Thanks for posting in the MSDN Forum.
Would you please comment "xl.DisplayAlerts = False"? In my opinion that is a duplicated statement.
Let's see whether that action can solve your issue.
Have a good day,
Tom
Hi Tom,
It makes no difference for that particular issue. I added two versions of xl.DisplayAlerts = False when was debugging Excel popups when enabling custom addins. See my post
How to suppress dialog when installing addins from .NET
Thank you!
-
Monday, July 16, 2012 8:45 AMModerator
Hi,
I noticed this exception happens on some PCs, and others work, this is very key. General idea is the dependent assembly versions are different. Some are expected, some are not.
Process Explorer is the tool to compare the trival difference. You can set a breakpoint at the workbook open, launch Process Explorer while the exception happens. Below is an example.
Thanks.
Forrest Guo | MSDN Community Support | Feedback to manager
- Proposed As Answer by Forrest GuoMicrosoft Employee, Moderator Monday, July 16, 2012 8:46 AM
-
Wednesday, July 18, 2012 11:35 AM
Hi,
I noticed this exception happens on some PCs, and others work, this is very key. General idea is the dependent assembly versions are different. Some are expected, some are not.
Process Explorer is the tool to compare the trival difference. You can set a breakpoint at the workbook open, launch Process Explorer while the exception happens.
Thank you for the tip - it seems to be a great tool. I tried to debug it but without any results, though I've got a workaround solution - launch Excel via process rather than interop. Still, I could not find a reason why the original code throws an exception on some machines:
Dim xl As Excel.Applicationxl = New Excel.Application xl.Application.DisplayAlerts = False xl.DisplayAlerts = False xl.Workbooks.Open(fName)
I was thinking that it could be related to the workbook VBA code, references or some settings in that workbook (e.g. recalculate options). So, I tested this code on a simple empty workbook with a single macro on open - msgbox "Hello world". Still the same problem.
Interesting that it throws an exception on xl.Workbooks.Open(fName), but the Excel process is actually being launched. It is a hidden workbook; I have to kil the process via Task Manager.
-
Thursday, July 19, 2012 3:40 AMModerator
Nice to know that you've got workaround. It could be forula calculation problem. Try setting calculation = manual and see if it fix the issue. I was referring to: http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/b0ac73a4-7a54-4d10-a1dd-54404ff1678e/
Forrest Guo | MSDN Community Support | Feedback to manager
- Marked As Answer by Forrest GuoMicrosoft Employee, Moderator Tuesday, August 07, 2012 2:36 AM
-
Saturday, October 06, 2012 3:11 PMYou may try to use http://www.recoverytoolbox.com/repair_excel.html to repair excel worksheets, fonts, formulas, cells, columns, rows and etc.

