Excel automation

edited 4:40AM in FastScript
I'm having problems automating Excel.

var
Excel, Book, Sheet: variant;
pippo: string;
begin
Excel := CreateOleObject('Excel.Application');
Excel.Visible := True;
Book := Excel.Workbooks.Add;
Sheet := Book.ActiveSheet;

pippo := 'asd';
Sheet.Cells.Item(1,1) := pippo; //Works
pippo := Sheet.Cells.Item[1,1]; //Doesn't work
ShowMessage(pippo);

Excel.Quit;
Excel := Null;
end.

The code above works correctly in delphi 7 where i have to use sqare brackets in ofder to find the member.

In FastScript the line in bold doesn't work (neither it does using round brackets).
The error is:

OLE error 8002000E: Item

If I use round brackets

OLE error 80020003: Item

How to read the value of a cell?

Comments

Leave a Comment