Sunday 15 April 2012

interop - c# and excel automation - ending the running instance -


I have the same problem. I read the whole formula and tried the given examples. I added these lines to the sample code:

  xlRange = (Excel.Range) xlWorkSheet.get_Range ("B1", "C1"); XlRange.Merge (Type.Missing); XLR = (Excel.Range) xlWorkSheet.get_Range ("H5", "M5"); XlRange.Merge (Type.Missing); XLRange = (Excel Ranges) xlWorkSheet.get_Range ("N5", "V5"); XlRange.Merge (Type.Missing); XLRz = (Excel Ranges) xlWorkSheet.get_Range ("W5", "Z5"); XlRange.Merge (Type.Missing); // Everything looks good here / up to ////////////////////////////////////// ///////////////////// // If I add these lines below, the process is hanged up to 1/9 only. I manually xlRange = ( Excel.Range) xlWorkSheet.get_Range ("AA5", "AB5"); XlRange.Merge (Type.Missing); Xlborder.borders.ightight = Excel.XlBorderWeight.xlThin; //////////////////////////////////////////////// /////////  

Before adding the excelashate object, I also added: Marshal. Release Com Object (XLR);

Please tell me how I should go about this because I am giving it almost. Your answer is very much appreciated FYI, I am a newbie and I am waiting for your reply.

Thank you, George

Excel is a COM automation server.

Even if you call Application.Quit () and you release the context of the COM object, the XE itself will not end. You will still be able to see it in the Task Manager. Excel examples will exit soon after its application closes. Excel Example will exit after your application closes. Excel Example will exit after your application closes.

Ever "RPC server is not found / running" type COM errors? Now you know why.


No comments:

Post a Comment