Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / October 2004

Tip: Looking for answers? Try searching our database.

Closing Excel

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bill - 27 Oct 2004 10:19 GMT
I have inherited an App desigend by an ex employee

Sometimes the program leaves Excel in the task manager

The programe uses various routines and calling various functions that define
Excel sheets etc (badly named)

I'm finding it hard to follow (my 1st experince of .NET)

is there a way to KILL any Excel instence when exiting the program.

I have come across some posts about GC (garbage collection)
like this
System.Runtime.InteropServices.Marshal.ReleaseComObject(oXLWsheet)
oXLWsheet = Nothing
'System.Runtime.InteropServices.Marshal.ReleaseComObject(oXLWs)
oXLWs = Nothing
oBook.Close()
System.Runtime.InteropServices.Marshal.ReleaseComObject(oBook)
oBook = Nothing
System.Runtime.InteropServices.Marshal.ReleaseComObject(oBooks)
oBooks = Nothing
oExcel.Quit()
System.Runtime.InteropServices.Marshal.ReleaseComObject(oExcel)
oExcel = Nothing
GC.Collect()
GC.WaitForPendingFinalizers()
-----

My problem is I don't know ALL the Sheets & Books etc that have been defined
/used
program loops about a lot

It would be nice just to do someting like

Loop Until NoMore
   GetProcessByName("EXCEL")
   Kill Process
END
Jim Rech - 27 Oct 2004 11:42 GMT
This might be more a .Net question and an Excel question.  While someone
passing through here may have something to contribute, you also might want
to ask a .Net newsgroup.

Signature

Jim Rech
Excel MVP

|I have inherited an App desigend by an ex employee
|
[quoted text clipped - 35 lines]
|    Kill Process
| END
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.