Excel automation

edited 4:33PM 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

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.