Closing Excel #2

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


0
bill12 (2)
10/27/2004 9:19:07 AM
excel.newusers 15348 articles. 1 followers. Follow

1 Replies
644 Views

Similar Articles

[PageSpeed] 50

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.

-- 
Jim Rech
Excel MVP
"Bill" <bill12@hotmail.com> wrote in message 
news:evvLIXAvEHA.2508@TK2MSFTNGP10.phx.gbl...
|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
|
| 


0
jrrech (1933)
10/27/2004 10:42:29 AM
Reply:

Similar Artilces:

Linked Charts in Excel 2000
I have an application that creates a multiple charts using data from a separate workbook. The chart workbook is sent to users at a another location. In the tools options edit menu I have uncheck "ask to update automatic links". When users open the chart workbook, it displays the File not found dialog box with the data workbook as the file. The users can click Cancel to not update the links, but I would like the chart file to not display the file not found dialog. Excel XP has a start up prompt button that lets you control the updating of the links. Does this feature exist i...

Excel
Since the worm blaster virus has hit our office, I'm having a lot of problems with the subtotal function. The file hangs up then I save it and close the file - when I go back into the file, the data has been subtotaled. Does anyone know what's going on? I actually had the IT guy uninstall and reinstall excel and that did not fix the problem. Could this be related to the fact that they just installed service pack 2 yesterday?!! >-----Original Message----- >MSBlaster didn't do anything to the Office load that I >know of... this has to be unrelated to the worm. I...

Version an Excel workbook
Does anyone know how I can save mutliple versions of an Excel workbook within one xls file, just as you can do in MSWord? I use XP; among my choices (File>Save OR Save As) is one to save the workbook as 97-2002/5.0-95 workbook. Is that what you want? -- Greeting from the Gulf Coast! http://myweb.cableone.net/twodays "Daisy Mims" <Daisy.Mims@radianmi.com> wrote in message news:0d5c01c3619c$a4b53f80$a501280a@phx.gbl... > Does anyone know how I can save mutliple versions of an > Excel workbook within one xls file, just as you can do in > MSWord? ...

Excel Question: Can I add images to a drop down list box?
Hey All, I was wondering if anyone knew a way to have a drop down box that was populated by images instead of straight text. Anyone out there have some insight they wouldn't mind sharing? Thanks, Croucho Pay some developers $100000 of dollars to come up with that excel addin. "Croucho" wrote: > Hey All, > > I was wondering if anyone knew a way to have a drop down box that was > populated by images instead of straight text. Anyone out there have some > insight they wouldn't mind sharing? > > Thanks, > Croucho only if you know VBS and can ...

Does anyone know any Excel Experts ?
ExcelExperts.com is has more work than people. We are looking for Excel / VBA experts to do targetted work on a job by job basis. More info here: http://excelexperts.com/excel-vba-jobs Nick Visit www.ExcelGoodies.Com...

ThisWorkbook.Close question
Please take a look at the code below: Public Sub DumbFoo ( ) ThisWorkbook.Close() Sheet1.Range("A1").Value = -1 ThisWorkbook.Save() End Sub Is it safe to assume that the code below the "ThisWorkbook.Close()" line will NOT be executed??? My question is basically: Does all VBA code stop executing once a .Close() function is called??? Thank you! I don't believe the code would execute at all because of the parentheses after Close. It would throw an error an tell you that something is missing, or type mismatch. But, if you did...

How to Enable Close(cross) button of MB_YESNO messagebox
Hi, I want to enable the close(cross) button in the right corner of YESNO message box. Can anybody tell me how to do this. Klic. "Klic" <rohit.turambekar@gmail.com> wrote in message news:1186120969.045121.287770@i13g2000prf.googlegroups.com... > I want to enable the close(cross) button in the right corner of YESNO > message box. > Can anybody tell me how to do this. Why? If there is a valid answer other than yes or no, then how about a yes/no/cancel message box in which (I would guess) the x button is equivalent to cancel. That would be more standard. Da...

Mouse Problem
When I click on any cell inside Excel, the application thinks that i'm holding the mouse button and then it keeps dragging/highlighting every cell. Therefore I cannot do anything inside Excel until I close it and open it again. Crazy for an answer, André (apvg2001@yahoo.com.br). Try hitting F8 >-----Original Message----- >When I click on any cell inside Excel, the application=20 thinks that i'm=20 >holding the mouse button and then it keeps=20 dragging/highlighting every cell.=20 >Therefore I cannot do anything inside Excel until I close=20 it and open it=20 >...

closing
What's the best way to close for the day? Making a backup is a given, but what about the computer? Is it better to shut everything off every day, or is it less wear and tear on the computer to leave it on all the time? Any thoughts on this would be appreciated. Craig That's a matter of preference really. Personally I always turn off my rigs at home when I'm done with them. At the store we leave most of ours on 24/7. We've done it for years with no issues. Our register must be left on as it does automatic backups to a tape drive every night. I'd set your monitors ...

Excel 2003 - VBA
I am driving a sheet with macros and sometimes cells are manipulated using offset. This can get very convoluted and doesn't always work for me. The current issue is as follows: I would like to select a cell, then use the information in that cell and others in the same row. Once I have completed cell data manipulation, I would like to select the first 25 cells in that row and change the background color to indicate that this is new data. In VBA, how do I select a range when I do not know the row, I just work off activecell and offset. Thanks, Craig If you are working off the active...

Great Plains Integration #2
Hi, I am new to Great Plains and would like some help from all you experienced hands to jump start my project. I am starting with an GP integration project. This involves the following : 1. When the user tries to add a new customer or a vendor, we should be able to select some of the fields entered by the user (like the customer code, name, shipping and billing address, country etc) and send this via an http call to a remote server where this is used for searching a database. If a hit is found in the remote database, it is returned (as a number like 0, 1 etc denoting the number of ...

Outlook closes and closes
Hi I have a strange bug. Windows XP Sp2 and outlook from office 20003 with all service packs applied. When I start outlook from windows out of standby postion, outlook immediately after the splash screen closes without reporting any errors in the eventlog or in any other log. If I start outlook the 10th time (or so) it stabilizes and does not close anymore and everything works again. info: My machine is fully patched and I am well known with keeping things healthy. Outlook.exe Version: 11.0.6353.0 Any ideas what to do? Thanks... try the detect and repair in the help menu. >----...

Standby in Excel
Everytime I want to get from one sheet to the next, I hit Control and Page Down at the same time. But instead of it going to the next sheet, my computer switches to Standby mode. Any idea how to disable this? Hi Lillian, That is not normal in Windows or Excel that I'm aware of. What make and model computer is it? Sounds like a BIOS setting if anything. -- John johnf 202 at hotmail dot com "Lillian" <lillian_simms@hotmail.com> wrote in message news:170be01c4183b$4fa13ac0$a501280a@phx.gbl... | Everytime I want to get from one sheet to the next, I hit | Control and ...

Excel 2003 charts will not auto update to new data. Ideas?
When I input new data in a cell it over top of data that is already in within the cell range of my chart, the new number will not show within the chart. The chart simply does not update unless I close the file and then open again. As a side note I'd like to mention: 1) The data that I change is already withing the cell range of the chart. 2) The data is withing the same work book. This is not a matter of linking books. Any ideas? ...

Excel Form and message box
Hi there, I'm running Excel 2000. I am just learning so please excuse my questions if they sound simple. To put this as simply as possible I have a spreadsheet of children's names. I've created a form that is activated by a control button. What I want to do is choose a child's name from the combo box and eventually delete that child from the spreadsheet. I have an "are you sure" type msgbox but cannot get the yes/no side of it functioning correctly. I've worked on this for hours and have just given up. This is my code so far: Private Sub cboRemChild_...

Help
When creating or fowarding an e-mail message using outlook 2000, scrolling through my "recipients" list (contacts) causes the program to close unexpectedly. So, I click "new", click "to", switch to my "contacts" list, and as I scroll through the names, the program just closes. Is there a possibility that one of my contact records is corrupt? I have opened all of my contacts and saved them without an error. This problem developed shortly after the install of Office 2000's calender update, and basic security update. I have since fully u...

page size #2
Please help me with this. I cannot for the life of me get the right margin to be at the 1/2 inch it is set to be. When I print the invoice that I created, it is about an inch wide on the right. I have used the page preview and moved margins and page size around, but to no avail. I am stuck. Thanks in advance, Jeff Hi, Please, no repeat posting on the same day. First, if your data doesn't extend far enough to the right to reach the 1/2 inch margin, it will look like there is a larger margin. A few options - in the spreadsheet widen a few columns of the print area. On th...

Excel hang-up/crash problem
I have two realively large workbooks with macros. Data is to b exchanged between them. But when I have both two open, Excel jus halts/crashes without any error message. Separately both works jus fine (also at the same time running in separate Excel applications). Any ideas on how to fix this? Could settings for mermory be the thing? How can I change the me settings? (i run Excel 2000 on XP Pro.) Thanx in advance! Georg Rokn -- Message posted from http://www.ExcelForum.com Hi gerok! Find and Select C:\Documents and Settings\<user>\local settings\temp Select all files and delete...

slide show of charts from excel
I have an excel file which is a shared workbook and is updated many times a day by several users which has several charts included at a remote location on our wan, i would like to display these charts in a slide show format on a large screen at my local office and have them permanently run and update as linked cells are changed by users. any help much appreciated. If you have the full Office Suite which includes PowerPoint you can link Excel Charts to a PowerPoint presentation. Otherwise...........I have no ideas. Gord Dibben MS Excel MVP On Wed, 21 Mar 2007 18:58:23 -0000, "...

Use of CLIPBOARD in EXCEL
Why do items put on to the CLIPBOARD in EXCEL disappear the moment ypu type something in a cell? Is there any way of disabling this very annoying feature? If you're using Excel 2002, or later version, you can use the Office Clipboard, which stores more items. To see it, choose Edit>Office Clipboard. alandwebb wrote: > Why do items put on to the CLIPBOARD in EXCEL disappear the moment ypu type > something in a cell? Is there any way of disabling this very annoying feature? -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html ...

Workflow Rule -> Closing Activity
I set up a Manual Workflow Rule for Contacts to close out Holiday Season cards sent. The rule uses a condition to check for Contacts with cards sent and then Creates an Activity to add to each of the appropriate Contacts for future reference. What else do I need to do to close out all of activites rather than 1 at a time? Here is the workflow rule if that helps: if Contact.holidaycardlist = 1 then Letter: Send Holiday Card endif -- Dan W Systems Engineer Denver, CO ...

smtp 550 error #2
Users are occasionally receiving smtp 550 5.7.1 error when sending (mostly replying) to recipeints outside of our domain. Help? We have Exchange 2003 server. All outbound SMTP traffic sent directly from the smtp virutal server to the Internet. Can you post the NDR? Numeric Code: 5.7.1 Possible Causes: . General access denied, sender access denied - the sender of the message does not have the privileges required to complete delivery. . You are trying to relay your mail through another SMTP server and it does not permit you to relay. . The recipient might have mailbox deliver...

Auto-close Quotes when Closing Opportunity
We would like the ability to close an opportunity and have it ask if you want to close all the associated quotes. Right now, it says you can’t close the opp until you close all the open quotes and you have to each one of those one by one. Barring that, if we could select multiple quotes and click on a menu item (Close all selected quotes), that would be most useful. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not ...

Excel/ Word Viewer
Hi, I am desperately looking for a solution, for security reasons, to hide or disable the "File" option once the viewer is opened. I do not believe this would possible without re-writing the code contained in the Viewer Executable or DLL. XLViewer is just that..a Viewer Viewing and Printing of Excel files is its function. Gord Dibben Excel MVP On Thu, 7 Oct 2004 01:11:23 -0700, "Varghis Cherian" <anonymous@discussions.microsoft.com> wrote: >Hi, > >I am desperately looking for a solution, for security >reasons, to hide or disable the "File&qu...

Data file not closed properly #3
I saw several post regarding this, but none had any answers, so I starting a new post. There is also nothing in the KB about this. Since othe people are having the same problem Microsoft should take a look at it. I get the message "The data file 'Personal Folders" was not closed properly" every time I close Outlook 2003. It runs a quick check/fix and starts up fine. I am running XP pro w/ SP-2. Outlook 2003 w/ SP-1 All patches and updates are current. My notebook was just rebuilt for so I could get a clean slate for the office 2003 install, (reformat drive and new ins...