Windows error 0x800401A8, -2147221080

Detailed Error Information

HRESULT analysis[1]

FlagsSeverityFailure
Reserved (R)false
OriginMicrosoft
NTSTATUSfalse
Reserved (X)false
FacilityCode4 (0x004)
NameFACILITY_ITF[1][2]
DescriptionThe source of the error code is COM/OLE Interface management.[1][2]
Error Code424 (0x01a8)

Questions

6votes
2answers

Opening a saved workbook causes the current workbook to throw exceptions

I'm trying to open a save Excel workbook while keeping a reference to the current workbook. The issue is that as soon as I open the saved workbook, the original throws an exception upon access. Here's a code snippet to demonstrate. I put this in an event handler for a [...] read more
c#
excel
vsto
5votes
3answers

In Excel VSTO, how can I check if a worksheet belongs to a closed workbook?

If I have a reference to Worksheet and I close it's parent Workbook, the reference doesn't go away. But I can't figure out how I should check to make sure these sheets don't exist. Checking for null doesn't work. Example: Workbook book = Globals.ThisAddIn.Application.ActiveWorkbook; Worksheet sheet = (Worksheet)book.Worksheets[1]; // Get [...] read more
c#
excel
com
vsto
comexception
3votes
7answers

Detecting if Excel file has been closed

I've spent the past 3 hours trawling the web for answers to no avail, so I hope you can help me. I'm writing an application which automates Excel. The application has an option to "show/hide the excel sheet" so you can look at it, make any final changes and so [...] read more
c#
.net
3votes
2answers

Open an excel file in exclusive mode using interop in C#

In my application I want to be able to open an excel file that already exists, and add information to this file. I use the Microsoft Interop libraries. I have noticed that if you create a new spreadsheet using Add and then Saveas you can set the file to be [...] read more
c#
excel
interop
2votes
0answers

Handling Exception from HRESULT: 0x800401A8

I have a application where on Button click excel sheet will be opened and Data will be inserted into it. If i close excel sheet before inserting data folloeing exception occurs.. Exception from HRESULT: 0x800401A8 Is ther any way to handle this. My code is Excel.Application objApp = null; Excel._Workbook [...] read more
excel
c#-4.0
exception-handling
1vote
1answer

HRESULT: 0x800401A8 when getting UsedRange of Worksheet

I'm trying to open an Excel Sheet, get the UsedRange and loop through it. This already worked once, but then I had the exception > COM object that has been separated from its underlying RCW cannot be used after using System.Runtime.InteropServices.Marshal.ReleaseComObject(xlApp); System.Runtime.InteropServices.Marshal.ReleaseComObject(xlWorkBook); System.Runtime.InteropServices.Marshal.ReleaseComObject(xlWorkSheet); Note that the exception kept coming up [...] read more
c#
excel
com
1vote
1answer

Problem opening Excel workbook using Excel Interop

I'm writing a C# forms application to open an existing Excel workbook using the Excel Interop. Everything works fine. I can read and write fine. I do not save the workbook until the user close the C# application. The problem happens when my program is running and the user accidentally [...] read more
c#
windows
excel
forms
interop
0votes
0answers

Populating multiple Excel spreadsheets from a text file

I need to populate a new spreadsheet for every 26 rows in a text file. I have created the initial spreadsheet but get the error System.Runtime.InteropServices.COMException:Exception from HRESULT:0x800401A8 when it starts the second file creation. read more
excel
0votes
2answers

c# excel. How pass workbook/sheet as reference

I want to pass an excel workbook/sheet as a reference between several functions in order to do different operations on it. I have been looking for hours and can't find out how to do this. Is this not common practice to have multiple functions work on an excel sheet in [...] read more
c#
excel
reference
0votes
0answers

Can't seem to load information from excel file (C# & Excel Interop)

So I have created this program and it should reset the value and type of the cell to 1 and integer on startup. Then when the user wants to add a name, it should read the value and set it as AmountNumD (because it seems to detect it as a [...] read more
c#
excel
0votes
1answer

Writing Workbook with multiple sheets into a single text file

I'm trying split up the following code onto multiple threads (one for each sheet in the workbook). With over 400,000 rows to work on collectively, this would take quite some time on 1 thread, I'm hoping that if I split it, this will speed it up. It's been a while [...] read more
vb.net
excel-2007
excel-interop
-1votes
2answers

Debugging COM Interop HResult codes (VSTO)

I have an Excel add-in firing an HRESULT 0x800401A8 error, when calling the getter of Worksheet.Parent. I would be glad if anyone could let me know what the error might be, but more importantly and more generally, I would like to know how I can understand these HResult codes? I [...] read more
debugging
com
vsto
office-interop
hresult
-1votes
1answer

Filling Excel Workbook from sqlserver HRESULT: 0x800401A8 error

I am trying to fill an excel sheet from SQL Server database and getting a message with code > HRESULT: 0x800401A8 Please assist me. Dim file As String = "C:\Techform.xlsx" Dim xlApp_2 As New Excel.Application xlApp_2.Visible = False xlApp_2.DisplayAlerts = False Dim oBook As Excel.Workbook oBook = xlApp_2.Workbooks.Open(file) Dim oSheet [...] read more
sql
vb.net
multithreading
excel

Comments

Leave a comment

(plain text only)

Sources

  1. https://msdn.microsoft.com/en-us/library/cc231198.aspx
  2. winerror.h from Windows SDK 10.0.14393.0

User contributions licensed under CC BY-SA 3.0