Click here to Skip to main content
15,888,025 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Everybody,

I m facing the two problems RPC unavailable exception , Excel.exe in Task manager

For my windows application i need to copy a template excel file and rename as Today's Date file.Then write the contents , close like excelApp.Quit() , saves the excel sheets also.


Excel.exe
But still the Excel.exe is exists in Task manager. Why? How to avoid?
I closed the excel application properly.

RPC server unavailable exception
I copied the template file as Today's date file.
when I try to open the Today's date file exception as occurring like RPC unavailable exception. Why? How to solve?

C#
wbApp = excelApp.Workbooks.Open(fileName, Type.Missing, Type.Missing, Type.Missing,Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);

wsApp = (Microsoft.Office.Interop.Excel.Worksheet)wbApp.Sheets[1];



please help me
Thanks in advance

Note - I am using C#, .Net
and 2003 MS office
Posted
Updated 20-Apr-11 2:41am
v3

I do not know how to help with the Task bar issue, perhaps someone else will have a solution.

For the RPC error, take a look at this[^] thread on MSDN also concerning Office 2003. (Scroll down to the second last answer).
 
Share this answer
 
About the first problem you have to free all of the COM objects created.
It's a goot tip that when you using COM objects, don't use two dots!
Like this:
Do not write this: application.Workbooks.Open(filename)
Write this:
workbooks = application.Workbooks;
workbook = workbooks.Open(filename);


then at the end you have to free that tow objects by following code:

workbook.Close();
Marshal.ReleaseComObject(workbooks);
Marshal.ReleaseComObject(workbook);
Marshal.ReleaseComObject(application);
application.Quit();
 
Share this answer
 

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