473,395 Members | 2,151 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Excel persists after .Quit()

Does anyone know whats going on here?

I'm filling Excel with data via a VB.NET app, then
closing it as follows, but an Excel Object seems to
remain alive.

Private Function CloseExcel(ByVal strFile As String) As
Integer

If strFile.Length > 0 Then
oBook.SaveAs(strFile)
Else
oBook.Close(False)
End If

oSheet = Nothing
oBook = Nothing
appExcel.Quit()
appExcel = Nothing
System.GC.Collect()

End Function

In Task Manager it can clearly be seen and when I try and
open the spreadsheet by double clicking on it nothing
happens.

Excel dissapears once I close my app, but I need to have
both running.
Nov 22 '05 #1
1 1048
Steven,

Make sure you call the following on every excel object that you instantiate:
System.Runtime.InteropServices.Marshal.ReleaseComO bject(exlObject). This
call explicitly decreases the COM reference counter.

Dan

"Steven" <st************@saic.com> wrote in message
news:02****************************@phx.gbl...
Does anyone know whats going on here?

I'm filling Excel with data via a VB.NET app, then
closing it as follows, but an Excel Object seems to
remain alive.

Private Function CloseExcel(ByVal strFile As String) As
Integer

If strFile.Length > 0 Then
oBook.SaveAs(strFile)
Else
oBook.Close(False)
End If

oSheet = Nothing
oBook = Nothing
appExcel.Quit()
appExcel = Nothing
System.GC.Collect()

End Function

In Task Manager it can clearly be seen and when I try and
open the spreadsheet by double clicking on it nothing
happens.

Excel dissapears once I close my app, but I need to have
both running.

Nov 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Mike | last post by:
Please help. I am using object.quit in an attempt to quit an excel application that I started with createobject ("Excel.Application"). The code executes, but does not stop the application. When...
1
by: Steven | last post by:
Does anyone know whats going on here? I'm filling Excel with data via a VB.NET app, then closing it as follows, but an Excel Object seems to remain alive. Private Function CloseExcel(ByVal...
3
by: Otie | last post by:
I found the following under the GetObject help notes and in the example for GetObject: "This example uses the GetObject function to get a reference to a specific Microsoft Excel worksheet...
6
by: Matthew Wieder | last post by:
I have the following requirements: Build a stand-alone C# application that asks the user to click in a cell in an Excel spreadsheet, and then displays the address of that cell in the C#...
2
by: lasmit42 | last post by:
Guys I am writing a program which reads the first cell of many Excel spreadsheets and then takes some actions. The problem that I am experiencing is that each Excel instance I create persists...
5
by: Wenke Ji | last post by:
Hi I open a Excel workbook using below API: Set ExcelServer = CreateObject("EXCEL.Application") Set TargetWorkbook = ExcelServer.Workbooks.Open (CurrentBook) Befor the programm exit , I use...
5
by: David C. Allen | last post by:
I have a vb.net app that is controling excel 2000 thru the com interop interface. I have referenced the excel 9.0 library and have cut down the code in the problem subroutine to this: Dim...
2
by: ChrisFrohlich | last post by:
I have been trying to use the Office PIA's to write an ASP.NEt page to: 1. Open a template workbook 2. Populate some data 3. Save the file back to the server 4. Quit Excel and free up Memory I...
16
by: alexia.bee | last post by:
Hi all, In some weird reason, excel instance won;t die if i remove the comment from 4 lines of setting values into struct. here is a snipcode public...
13
by: chuckie_9497 | last post by:
hello all you gurus. I am struggling with releasing com objects. I have isolated the problem to the code below. Objects are released and the process ends until I use "int k = sheet.Count;" Then...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.