View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Phil Hibbs Phil Hibbs is offline
external usenet poster
 
Posts: 100
Default Detecting an orphaned Excel.Application

I sometimes create an Excel.Application object, and use that to open
another workbook, read the contents, then close and quit it. If my
code crashes or if I interrupt it, the application object stays
running and still has the workbook open. The only way that I have of
tidying this up is to close any other Excel spreadsheets that I have
open and quit out, then open a spreadsheet by double-clicking on it,
this will make Excel notice that there is an Excel application object
already running and re-use that to open the workbook, and then I can
see that it has another workbook already open, and I can quit it.

Is there any other way to detect a hidden Excel application instance
that is running hidden, and specifically direct it to close? Other
than running Task Manager and forcing EXCEL.EXE to close, I mean, is
there anything I can do within an Excel macro to tidy it up?

Phil Hibbs.