vb.net Interop Excel - Excel application will not quit


i'm trying excel process quit after doing manipulation, i've tried methods suggested , nothing seems work. here code:

dim xlapp excel.application  dim wbs excel.workbooks  dim wb excel.workbook  dim wss excel.sheets  dim ws excel.worksheet  xlapp = new excel.application()  xlapp.visible = false  wbs = xlapp.workbooks  wb = wbs.open(tmpfile)  wss = wb.worksheets  ws = wss(1)  ws.pagesetup.orientation = microsoft.office.interop.excel.xlpageorientation.xllandscape  ws.pagesetup.leftmargin = 10  ws.pagesetup.topmargin = 10  ws.pagesetup.rightmargin = 10  ws.pagesetup.bottommargin = 10	  ws.pagesetup.zoom = false  ws.pagesetup.fittopageswide = 1  ws.pagesetup.fittopagestall = 100  wb.save()    system.runtime.interopservices.marshal.releasecomobject(ws)  ws = nothing  system.runtime.interopservices.marshal.releasecomobject(wss)  wss = nothing  wb.close()  system.runtime.interopservices.marshal.releasecomobject(wb)  wb = nothing  system.runtime.interopservices.marshal.releasecomobject(wbs)  wbs = nothing  xlapp.quit()  system.runtime.interopservices.marshal.releasecomobject(xlapp)  xlapp = nothing

i've tried gc.collect() , gc.waitforpendingfinalizers() system hangs application still running. not want use process.kill because it's dangerous.

any appreciated.

hi,

if wanna free reference used in code, can refer link below:

if want kill process excel created, can refer thread in forum:

good luck , have nice day!


hope helpful you! if have further quetions, please feel free let me know.
please mark right answer @ right time.
bset regards,
tracy


.NET Framework  >  Common Language Runtime Internals and Architecture



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'