View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default 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?