OLE-Excel

edited 11:37PM in FastScript
Hello!

I have found out, that this script leaves a running process named Excel in the Windows Taskmanager:

Variant Excel = CreateOleObject("Excel.Application");
Excel.Visible = true;
String ExcelFile = "d:\Lehrverpflichtung.xls"; // Pfad der ExcelDatei
Excel.Workbooks.Open(ExcelFile);
Variant Sheet = Excel.ActiveWorkbook.ActiveSheet;
Sheet.Cells.Item(1,1).Value = "Hello";
Excel.ActiveWorkbook.Save();
Excel.Workbooks.Close();
Excel.Quit();

The Quit function closes Excel, but in memory there is a Process EXCEL.EXE left.
I suppose, the OleObject is not destroyed, at the end of the Script.
A Bug or a feature?

Comments

  • edited 11:37PM
    It is normal. The same code in the Delphi (or BCB) clears the interface by _IntfClear call at the end of the method. I can't use _IntfClear - it is for internal use only and can't be accessed.
    FS leave one "Excel" process per application (independent from how many script you have executed). This process is terminated when you exit your application.
  • edited July 2004
    Thanks very much!

Leave a Comment