Excel-Connection with Delphi

From: Heiko Schmidtke (Heiko.Schmidtke_at_schott.com)
Date: 03/24/05


Date: Thu, 24 Mar 2005 11:30:55 +0100

Hello everybody!

I need to open a couple of Excel-sheets sequencially with Delphi2005. This
for opening, reading and closing them.
Principally this works:

      Uses Excel2000, COMObj
      ....
      var Excel:variant;
      ....
      Excel:=CreateOLEObject('Excel.application');
      Excel.Workbooks.Open(Pfad);
      Excel.Workbooks.close;

Problem: My excel-files contains a function that leads excel ask whether you
want to save or not. Even if you did not change the excel file.
Unfortunately this also happens when closing the excel file with Delphi
using Excel.Workbooks.close;
How can I suppress the requester.

With Standard Excel-VBA the term Workbooks.close(false) works. You do not
get any requester.

But using Delphi this line
Excel.Workbooks.close(false);
Or
Excel.Workbooks.close(0);
lead to a error message "wrong parameter".

Any hint?

Heiko