Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > closing excel

Reply
Thread Tools

closing excel

 
 
Mark
Guest
Posts: n/a
 
      04-13-2004
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>
 
Reply With Quote
 
 
 
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      04-13-2004
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" <> wrote in message
news: 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>



 
Reply With Quote
 
 
 
 
Mark
Guest
Posts: n/a
 
      04-14-2004
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]" <> wrote in message news:<#>...
> 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" <> wrote in message
> news: 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>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Excel reports ::::Excel 2003 Migration To Excel 2007 =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?= ASP .Net 15 10-24-2007 01:34 PM
Closing popup window when closing parent window? =?Utf-8?B?Vk1J?= ASP .Net 3 02-15-2007 08:29 AM
Closing the doors 15 minutes before closing. doofus Computer Support 12 06-11-2005 08:20 AM
Closing an excel workbook fires Workbook_BeforeClose Winshent ASP .Net 0 11-03-2004 03:53 PM
Closing child window WITHOUT closing parent thomas Javascript 0 10-23-2003 04:10 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57