Closing Excel Instance

  • Thread starter Thread starter harkit
  • Start date Start date
H

harkit

Hi

I am Rajesh

I want to display an Excel file <file.xls> in Internet Explorer 6.0.
am currently displaying the xls file in the browser using javascrip
code in the click event of a button.

The problem is that when I close the browser, the excel instanc
remains in the list of processes in Task Manager.

Please help me how I can close that instance. Any suggestion or hin
will be of great help to me.

Thanks in Advance
Rajes
 
This usually is caused by creating a reference to Excel which is not
released. This can be done by using a construct like

xlapp.ActiveSheet.Sort Range("A1")

where the reference to cell A1 is not fully qualified.

xlApp.Activesheet.Sort xlapp.ActiveSheet.Range("A1")
would be the proper way to do it.

If you are only displaying the sheet, then perhaps this is not applicable -
but you may otherwise not be releasing your reference.
 
If you created the Excel instance as an object you have to destroy the object
when you're done with it. In VBScript it would have been something like "Set
myApp = Nothing". Hope this helps.
 
Tom Ogilvy said:
This usually is caused by creating a reference to Excel which is not
released. This can be done by using a construct like

xlapp.ActiveSheet.Sort Range("A1")

where the reference to cell A1 is not fully qualified.

xlApp.Activesheet.Sort xlapp.ActiveSheet.Range("A1")
would be the proper way to do it.

If you are only displaying the sheet, then perhaps this is not applicable -
but you may otherwise not be releasing your reference.
Hi,
You also can try these tips :
- if your Excel file is displayed in an Frame or Iframe, clean the Frame by
frame.location="about:blank";
- try the CollectGarbage method like this (found in an other javascript
newsgroup post)

excelapp = new ActiveXObject("Excel.Application");
......
excelapp.workbooks(exlfilenames).Close(); // for all workbooks
excelapp.Quit();excelapp=null;
idTmr = window.setInterval("Cleanup();",5);

function Cleanup() {
window.clearInterval(idTmr);
CollectGarbage();
window.close();
}
 
Back
Top