Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
using C# Code read Excel and Then close work book Then Error
VB
The object invoked has disconnected from its clients.
 (Exception from HRESULT: 0x80010108 (RPC_E_DISCONNECTED))
Posted
Comments
Maciej Los 6-Aug-13 3:20am    
DO you think we can see your monitor? No! Please, share your code which raises error. Without it we can't help you.
Yogesh N Sh 6-Aug-13 7:08am    
if (_workbook != null)
_workbook.Close(SaveChanges: false, RouteWorkbook: false);
while (Marshal.ReleaseComObject(_workbook) > 0) ;
_workbook = null;

Its Run successfuly But When Its Run Through code And Then I Open Excel Manually Then Last when Workbook is close Then Exception Is come
}
Maciej Los 6-Aug-13 15:53pm    
Please, debug your program and write in which line error occurs.
Yogesh N Sh 7-Aug-13 0:28am    
if (_workbook != null)
_workbook.Close(SaveChanges: false, RouteWorkbook: false);---this Line error Occurs
while (Marshal.ReleaseComObject(_workbook) > 0) ;
_workbook = null;
adriancs 7-Aug-13 1:43am    
Something is wrong before this code. We can't tell what is wrong without seeing the codes before this.

 
Share this answer
 
Comments
Yogesh N Sh 7-Aug-13 0:31am    
i Not Create Excel Global Variable but Still Error come
This is about handling Excel Documents with Microsoft.Office.Interop.Excel.

try to have a look at here: http://excelconverter.codeplex.com/documentation[^]

It is a small program of Conversion of Excel Documents.

Inside the main class of the program (Simple Microsoft Excel Documents Converter) - ExcelDocConverter, there are 2 important methods
C#
ReleaseExcelResources();
KillExcelProcessThatUsedByThisInstance();

which used to handle and release the both resources of Excel.EXE and the opened Excel document from the memory.
You may want to have a look.
 
Share this answer
 
Comments
Yogesh N Sh 7-Aug-13 0:30am    
i have allready relasecomobject And KillApplication But error is come when closing workbook.Close(false,false); when Open manual Other Manual excel sheet
adriancs 7-Aug-13 1:40am    
I see. There are some hidden information which is not provided yet.
I can't guess what is your code's error in other part without seeing the code.
Yogesh N Sh 7-Aug-13 4:34am    
i open another excel sheet manually Then last when Background is complete To print and workbook.close Then error Occurs The object invoked has disconnected from its clients.
(Exception from HRESULT: 0x80010108 (RPC_E_DISCONNECTED)).my code is Simple like worbook.close(false,false)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900