Not able to close the Excel Appliaction

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I've opened an Excel application, done something then I closed using
Application.Quit();

But It's not closing the Excel application. I need to kill iy from task
manager.

Please let me know any pointer for this.

Here is the code snippet:
======================================
ApplicationClass app = new ApplicationClass();
Workbook book = null;
Worksheet sheet = null;

book = app.Workbooks.Open(strFileName, bla, bla...);

<DOING SOMETHING>

app.Workbooks.Close();
app.Quit();
app=null;
..............................................................
..............................................................
================================

Lotsa thanks in advance.

Regards,
Lotus
 
Does it close down correctly if you don't perform any work, i.e. straight
after opening it?
 
No seeing the entire section of your code, just my guess:

If the code from
ApplicationClass app=...
to
app.Quit()
is within a single subroutine, it may be because of the variable "book" and
"sheet" are still in scope and not being set to null, so that the opened
Workbook and Worksheet objects is not release, hence, the app object can not
be close. If so, try to close opened Workbook and set "book" and "sheet" to
null before call app.Quit().
 
Back
Top