Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Close all Instances of Excel
I guess this is more of a vbscript question, but what
would be the best code to close all open instances of Excel? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Close all Instances of Excel
This script will close all instances of Excel and will NOT save any changes
made to the active workbookof each session: type the code in a file with extension VBS, locate it in Explorer & double click. CloseExcel SUB CloseExcel() on error resume next set xl =getobject(,"Excel.Application") xl.activeworkbook.saved = true xl.Quit set xl = nothing call CloseExcel End Sub "Tod" wrote: I guess this is more of a vbscript question, but what would be the best code to close all open instances of Excel? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Close all Instances of Excel
This script works great for instances that are open and visible. Is
there a way to close all instances that are only onen in memory? AA2e72E wrote: This script will close all instances of Excel and will NOT save any changes made to the active workbookof each session: type the code in a file with extension VBS, locate it in Explorer & double click. CloseExcel SUB CloseExcel() on error resume next set xl =getobject(,"Excel.Application") xl.activeworkbook.saved = true xl.Quit set xl = nothing call CloseExcel End Sub "Tod" wrote: I guess this is more of a vbscript question, but what would be the best code to close all open instances of Excel? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Close all Instances of Excel
Were these created through code?
If so, it sounds like your code is faulty as they shouldn't exist. You won't be able to close them through automation - they are being held open by an unreleased reference. Until the reference is released (or overpowered), then they will remain. -- Regards, Tom Ogilvy "Tod" wrote in message oups.com... This script works great for instances that are open and visible. Is there a way to close all instances that are only onen in memory? AA2e72E wrote: This script will close all instances of Excel and will NOT save any changes made to the active workbookof each session: type the code in a file with extension VBS, locate it in Explorer & double click. CloseExcel SUB CloseExcel() on error resume next set xl =getobject(,"Excel.Application") xl.activeworkbook.saved = true xl.Quit set xl = nothing call CloseExcel End Sub "Tod" wrote: I guess this is more of a vbscript question, but what would be the best code to close all open instances of Excel? |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Close all Instances of Excel
Okay. Actually there are a few dozen excel applications being open (not
all at once of course) and updated through scheduled tasks. I didn't write them, but am having to contend with the mess that many of them leave behind. I'm fixing the code in them as I go, but was hoping for an interim way of closing these open instance of Excel before they totally hose the memory on the server. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Close all Instances of Excel
Oh also, would there at least be some kind of code I could use to get
information about an open instance of Excel? What workbook is open, etc? Tod wrote: Okay. Actually there are a few dozen excel applications being open (not all at once of course) and updated through scheduled tasks. I didn't write them, but am having to contend with the mess that many of them leave behind. I'm fixing the code in them as I go, but was hoping for an interim way of closing these open instance of Excel before they totally hose the memory on the server. |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Close all Instances of Excel
Perhaps you can start with this:
http://support.microsoft.com/default...b;en-us;176391 How To Programmatically Close a Single Instance of a Windows-Based Program I expect that you will have to use the terminateprocess function it describes and says to use with caution. But I don't know. Then again, these processes may not have windows (but I think they would). This may have some useful information although not directly applicable: http://support.microsoft.com/default...b;en-us;231844 How To Detect If an Application Has Stopped Responding -- Regards, Tom Ogilvy "Tod" wrote in message oups.com... Okay. Actually there are a few dozen excel applications being open (not all at once of course) and updated through scheduled tasks. I didn't write them, but am having to contend with the mess that many of them leave behind. I'm fixing the code in them as I go, but was hoping for an interim way of closing these open instance of Excel before they totally hose the memory on the server. |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Close all Instances of Excel
maybe by reading the caption of the childwindow if it has any. Since these
sound like partially closed versions of excel, I am not sure what you can do with them. If GetObject doesn't find them, I am not sure how useable they are. This certainly isn't something I am an expert on, so someone else may have a better idea. -- Regards, Tom Ogilvy "Tod" wrote in message ups.com... Oh also, would there at least be some kind of code I could use to get information about an open instance of Excel? What workbook is open, etc? Tod wrote: Okay. Actually there are a few dozen excel applications being open (not all at once of course) and updated through scheduled tasks. I didn't write them, but am having to contend with the mess that many of them leave behind. I'm fixing the code in them as I go, but was hoping for an interim way of closing these open instance of Excel before they totally hose the memory on the server. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
If two instances of Excel open top right "X" close only one | Excel Discussion (Misc queries) | |||
why do all excel worksheets/workbooks close when I close one? | Excel Discussion (Misc queries) | |||
Excel shoud not close all active books when clicking close button | Excel Discussion (Misc queries) | |||
I can't save a file unless I close all excel instances or it's th. | Excel Discussion (Misc queries) | |||
excel - Windows close button (x) should only close active workboo. | Setting up and Configuration of Excel |