|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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.
|
|
#3
|
|||
|
|||
|
Use the following code
excel.Application.Quit() excel = Nothing |
|
#4
|
|||
|
|||
|
Quote:
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. |
|
#5
|
|||
|
|||
|
excel.exe in memory
This worked for me
Dim Process1 As Process() = System.Diagnostics.Process.GetProcessesByName("Excel") Process1(0).Kill() Good luck earl suminda |
|
#6
|
|||
|
|||
|
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 |
|
#7
|
|||
|
|||
|
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 |
|
#8
|
|||
|
|||
|
kill excel
Hi,
What is the error you getting?. Earl Quote:
|
|
#9
|
|||
|
|||
|
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 { }
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > ASP Development > excel.exe in memory |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|