By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,495 Members | 1,252 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,495 IT Pros & Developers. It's quick & easy.

closing excel

P: n/a
Hi all,

as many had, i have some problems terminating the excel-process.
I implemented the solutions i found in this forums. Tried most
combinations of them ;-).
It still doesn't work.

I'll post my code-snippets below. I hope u can shine some light on the
solution.

Thx,

Mark

<code>
Dim excelApp As Excel.Application = New Excel.Application
Dim excelWorkbook As Excel.Workbook
Dim excelSheetInput As Excel.Worksheet
Dim excelSheetOutput As Excel.Worksheet

<doin sumthing>

Finally
excelSheetInput = Nothing
ReleaseCOMObject(excelSheetInput)
excelSheetOutput = Nothing
ReleaseCOMObject(excelSheetOutput)
'excelWorkbook.Close()
excelWorkbook = Nothing
ReleaseCOMObject(excelWorkbook)
excelApp.Quit()
excelApp = Nothing
ReleaseCOMObject(excelApp)
System.GC.Collect()
End Try
</code>
<code>
Try
System.Runtime.InteropServices.Marshal.ReleaseComO bject(pobj)
Catch
Finally
pobj = Nothing
End Try
</code>
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
This article shows how to shut down Excel and it worked for me.
http://www.aspnetpro.com/NewsletterA...200309so_l.asp

But really you shouldn't be using Excel from an ASP.NET application. It
just wasn't designed for scenarios like this so I'm not surprised its giving
you problems. The article also explains other ways to use Excel documents,
and it lists a couple of fine 3rd party products that might also help.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net


"Mark" <ma********@hotmail.com> wrote in message
news:7e**************************@posting.google.c om...
Hi all,

as many had, i have some problems terminating the excel-process.
I implemented the solutions i found in this forums. Tried most
combinations of them ;-).
It still doesn't work.

I'll post my code-snippets below. I hope u can shine some light on the
solution.

Thx,

Mark

<code>
Dim excelApp As Excel.Application = New Excel.Application
Dim excelWorkbook As Excel.Workbook
Dim excelSheetInput As Excel.Worksheet
Dim excelSheetOutput As Excel.Worksheet

<doin sumthing>

Finally
excelSheetInput = Nothing
ReleaseCOMObject(excelSheetInput)
excelSheetOutput = Nothing
ReleaseCOMObject(excelSheetOutput)
'excelWorkbook.Close()
excelWorkbook = Nothing
ReleaseCOMObject(excelWorkbook)
excelApp.Quit()
excelApp = Nothing
ReleaseCOMObject(excelApp)
System.GC.Collect()
End Try
</code>
<code>
Try
System.Runtime.InteropServices.Marshal.ReleaseComO bject(pobj)
Catch
Finally
pobj = Nothing
End Try
</code>

Nov 18 '05 #2

P: n/a
Ty for your response.
I solved, thx to other sources, by specificly use variables for all
objects used in the process (sheets-collection etc.) and placing the
close- quit and terminate-statements in the rite order.

I will study the article u r referring too.
Maybe i will find some good arguments which i can use to convince my
client not to use Excel. They kinda insist at the mo in using Excel
(hey it works fine with j2ee too).

Grtz,

Mark

"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message news:<#D**************@TK2MSFTNGP12.phx.gbl>...
This article shows how to shut down Excel and it worked for me.
http://www.aspnetpro.com/NewsletterA...200309so_l.asp

But really you shouldn't be using Excel from an ASP.NET application. It
just wasn't designed for scenarios like this so I'm not surprised its giving
you problems. The article also explains other ways to use Excel documents,
and it lists a couple of fine 3rd party products that might also help.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net


"Mark" <ma********@hotmail.com> wrote in message
news:7e**************************@posting.google.c om...
Hi all,

as many had, i have some problems terminating the excel-process.
I implemented the solutions i found in this forums. Tried most
combinations of them ;-).
It still doesn't work.

I'll post my code-snippets below. I hope u can shine some light on the
solution.

Thx,

Mark

<code>
Dim excelApp As Excel.Application = New Excel.Application
Dim excelWorkbook As Excel.Workbook
Dim excelSheetInput As Excel.Worksheet
Dim excelSheetOutput As Excel.Worksheet

<doin sumthing>

Finally
excelSheetInput = Nothing
ReleaseCOMObject(excelSheetInput)
excelSheetOutput = Nothing
ReleaseCOMObject(excelSheetOutput)
'excelWorkbook.Close()
excelWorkbook = Nothing
ReleaseCOMObject(excelWorkbook)
excelApp.Quit()
excelApp = Nothing
ReleaseCOMObject(excelApp)
System.GC.Collect()
End Try
</code>
<code>
Try
System.Runtime.InteropServices.Marshal.ReleaseComO bject(pobj)
Catch
Finally
pobj = Nothing
End Try
</code>

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.