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
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.
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.
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).
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.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.