ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old November 18th, 2003, 03:35 AM
msrnivas msrnivas is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 30 msrnivas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 15
excel.exe in memory

Hi i am doing project in asp.net using vb

i want to show the output in excel format.
after closing the excel application also
i can see the EXCEL.EXE in my taskmanager means in PRocesses tab i can see the
EXCEL.EXE. how to close this EXCEL>EXE from memory.If i run my code 10 times 10 EXCEL.EXE are shoing in taskmanager.

my code like this

Dim excel As New Excel.Application
excel.Application.Workbooks.Add(True)
lcdgrd.Visible = True
Dim table1 As System.Data.DataTable
table1 = GetData()
Dim col As DataColumn
Dim colIndex As Integer
Dim rowIndex As Integer
rowIndex = 1
For Each col In table1.Columns
colIndex += 1
excel.Cells(rowIndex, colIndex) = col.ColumnName
Next col
Dim row As DataRow
For Each row In table1.Rows
rowIndex += 1
colIndex = 0

For Each col In table1.Columns
colIndex += 1
excel.Cells(rowIndex, colIndex) = row(col.ColumnName).ToString()
Next col
Next row
excel.Application.Visible = True
excel = Nothing


pl advice me. thanks
sr

Reply With Quote
  #2  
Old November 18th, 2003, 03:44 PM
wes wes is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 24 wes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Try "Set Excel = Nothing" rather than just "Excel = Nothing". I'm not sure if that will do it, but when I was working with Word under VB I didn't have this problem when the code executed correctly.

Reply With Quote
  #3  
Old January 29th, 2004, 10:47 PM
daud daud is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Auckland
Posts: 1 daud User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Use the following code
excel.Application.Quit()
excel = Nothing
Comments on this post
Nilpo agrees!

Reply With Quote
  #4  
Old February 2nd, 2004, 08:56 AM
alansmith alansmith is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: Seaton Devon
Posts: 18 alansmith User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 44 sec
Reputation Power: 0
Send a message via MSN to alansmith Send a message via Yahoo to alansmith
Quote:
Originally Posted by wes
Try "Set Excel = Nothing" rather than just "Excel = Nothing". I'm not sure if that will do it, but when I was working with Word under VB I didn't have this problem when the code executed correctly.



Excel will stay in memory until the user or the code closes the object. I have run into this problem before with vb's memory leakage. The best way to get around it is to dimension an excel application everytime you start you programme and terminate it at the end. This way there is only ever one excel object in use. If you still want the user to be able to manipulate the results use excel.document.add.

Reply With Quote
  #5  
Old October 1st, 2004, 12:35 AM
earls earls is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 2 earls User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 30 m 20 sec
Reputation Power: 0
excel.exe in memory

This worked for me

Dim
Process1 As Process() = System.Diagnostics.Process.GetProcessesByName("Excel")
Process1(0).Kill()

Good luck
earl suminda

Reply With Quote
  #6  
Old May 9th, 2005, 07:28 AM
theertendra1 theertendra1 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2005
Posts: 2 theertendra1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 m 29 sec
Reputation Power: 0
Exclamation kill excel

code is giving me an error shall i have to add any feature in order to make this code
work.

code is

Dim
Process1 As Process() = System.Diagnostics.Process.GetProcessesByName("Excel")
Process1(0).Kill()


waiting for ur response. please help me

Reply With Quote
  #7  
Old May 17th, 2005, 12:35 AM
theertendra1 theertendra1 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2005
Posts: 2 theertendra1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 m 29 sec
Reputation Power: 0
Exclamation how to kill excel.exe

u said that ur code has killed the excel application from the memory

but the same code is not working for me please help. its highly important

waiting for ur reply

Reply With Quote
  #8  
Old September 8th, 2005, 06:00 PM
earls earls is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 2 earls User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 30 m 20 sec
Reputation Power: 0
kill excel

Hi,
What is the error you getting?.
Earl
Quote:
Originally Posted by theertendra1
u said that ur code has killed the excel application from the memory

but the same code is not working for me please help. its highly important

waiting for ur reply

Reply With Quote
  #9  
Old July 1st, 2009, 09:48 AM
codeManJones codeManJones is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2009
Posts: 1 codeManJones User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 37 sec
Reputation Power: 0
C#

this works for me in C# (ASP, but likely works anywhere)

Code:
				
// clean up and quit excel
xlBook.Close(false, null, null);		
xl.Workbooks.Close();
xl.Quit();

System.Runtime.InteropServices.Marshal.ReleaseComO  bject(xlSheet);		//xlSheet is a Microsoft.Office.Interop.Excel._Worksheet
System.Runtime.InteropServices.Marshal.ReleaseComO  bject(xlBook);		//xlBook is a Microsoft.Office.Interop.Excel._Workbook
System.Runtime.InteropServices.Marshal.ReleaseComO  bject(xl);				//xl is a Microsoft.Office.Interop.Excel.Application

//quit excel.  for real. really stop excel. please? microsoft?
try { System.Diagnostics.Process.GetProcessesByName("Excel")[0].Kill(); }
catch { }

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > excel.exe in memory


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap