Asked by:
COM Object

Question
-
User2017643901 posted
Hello, How to kill the COM(Excel to say) object, which is running at the backend process when i tried simply to open a .xls file and close the same. I have some code : ---------------------------------------------- Dim app As Excel.Application app = New Excel.Application() app.Workbooks.Open(FileName:="D:\Projects\test.xls") app.Workbooks.Close() ---------------------------------------------- Cheers AbheeWednesday, October 9, 2002 9:24 AM
All replies
-
User-102356506 posted
Hi, I'm trying to kill it too... so I've try a cool app.quit instruction but the excel stand anyway in the task manager. so if anyone knows about this please send it here ;-)Tuesday, December 24, 2002 10:50 AM -
User640831702 posted
Hi Marc, I've got the same pb. I can't kill my Excel process even by using app.quit and app = nothing instructions. Did you solve this issue ? Tx Vincent ParisFriday, January 17, 2003 7:33 AM -
User640831702 posted
Ok, To resolve this issue, explicitly release the COM object by calling the following method System.Runtime.InteropServices.Marshal.ReleaseComObject(App) This method call forces the wrapper to release the reference. The wrapper is freed up when garbage collection occurs. And it works fine Further information available on MSDN : 305823 - PRB: COM+ Instance Count Does Not Decrease When Called from .NET Application Vincent PARISFriday, January 17, 2003 8:35 AM -
User-749607323 posted
Hello : I've got the same pb too if Using System.Runtime.InteropServices.Marshal.ReleaseComObject(app) Memory Could release the COM object EX: Dim MyExcel As Excel.Application MyExcel = New Excel.Application MyExcel.Quit() System.Runtime.InteropServices.Marshal.ReleaseComObject(MyExcel) MyExcel = Nothing But if insert open(filename) Memory Could Not release the COM object EX: Dim MyExcel As Excel.Application Dim MyWorkbook As Excel.Workbook MyExcel = New Excel.Application MyWorkbook = MyExcel.Workbooks.Open(FileName:="c:\Inetpub\wwwroot\doc\a.xls") MyWorkbook.close MyExcel.Quit() System.Runtime.InteropServices.Marshal.ReleaseComObject(MyExcel) MyExcel = Nothing Why ? AnyBody can HELP !Thursday, August 14, 2003 8:37 AM -
User-749607323 posted
Hello : I've got the same pb too if Using System.Runtime.InteropServices.Marshal.ReleaseComObject(app) Memory Could release the COM object EX: Dim MyExcel As Excel.Application MyExcel = New Excel.Application MyExcel.Quit() System.Runtime.InteropServices.Marshal.ReleaseComObject(MyExcel) MyExcel = Nothing But if insert open(filename) Memory Could Not release the COM object EX: Dim MyExcel As Excel.Application Dim MyWorkbook As Excel.Workbook MyExcel = New Excel.Application MyWorkbook = MyExcel.Workbooks.Open(FileName:="c:\Inetpub\wwwroot\doc\a.xls") MyWorkbook.close MyExcel.Quit() System.Runtime.InteropServices.Marshal.ReleaseComObject(MyExcel) MyExcel = Nothing Why ? AnyBody can HELP !Thursday, August 14, 2003 8:38 AM -
User-884863437 posted
HI, Try this code it works don't leave the line " app = nothing" and "GC.collect" Dim app As Excel.Application app = New Excel.Application() app.Workbooks.Open(FileName:="D:\gopudu\F1.xls") app.Workbooks.Close() app.Quit() app = Nothing GC.Collect() Good Day, SArunWednesday, November 19, 2003 11:36 PM -
User-1133784284 posted
Hi guys, Run into problem with excel. I initiate excel instance from asp.net under <identity impersonate > in the end i release all the instance with following codeoWb.Close(Nothing, Nothing, Nothing) oXL.Workbooks.Close() oXL.Application.Quit() oXL.Quit() System.Runtime.InteropServices.Marshal.ReleaseComObject(oRng) System.Runtime.InteropServices.Marshal.ReleaseComObject(oSheet) System.Runtime.InteropServices.Marshal.ReleaseComObject(oWb) System.Runtime.InteropServices.Marshal.ReleaseComObject(oXL) oRng = Nothing oSheet = Nothing oWb = Nothing oXL = Nothing GC.Collect()
but all forms in task manager window i am seeing excel instance is not released. and all the time i test the application. all the instance remain in memory. any suggestions,comment or solution? thanksMonday, January 26, 2004 6:03 PM -
User-1133784284 posted
Hi All, Well just update to my previous post. Now excel instances are getting terminated nicely with the code above. What i did is to change security config in dcomcnfg and adding user ASPNET and impersonated user in Access, Launch and Configuration Security and it did the trick and excel instance are now terminated properly. ThanksMonday, January 26, 2004 7:13 PM -
User68675309 posted
Thank you so much 'rnamin' i was searching for this for a long time. This worked fine.
Thanks
Thursday, February 15, 2007 4:14 AM -
User-1015121604 posted
iam facing the same problem...
your post is very helpfull..but can you tell me what are the modifications you have done in security settings and how to add a new aspnet user...
Thanx in advance
Kim
Saturday, April 21, 2007 3:15 PM -
User-654521100 posted
Hi, When I am running my page containing the excel.application as a stand alone page, then the excel.exes are being killed by garbage collection.
But when the page is being run under a virtual directory, then these excel.exes are not being killed. Can you suggest something for this.
Can you pls explain the settings mentioned in your post in some detail eg how did you add the impersonated user in dcomcnfg setting
Thursday, August 28, 2008 7:04 AM