You need this page:
http://www.djpate.freeserve.co.uk/AutoExcl.htm
which gives the following
(and stop calling Excel automation easy ;)
> Assuming a _Worksheet variable, WS:
>
> WS := Excel.ActiveSheet as _Worksheet;
>
> WS.Range['A1', 'A1'].Value := 'The meaning of life, the universe, and everything,
>is';
> WS.Range['B1', 'B1'].Value := 42;
>
> You can enter data into many cells at once:
> WS.Range['C3', 'J42'].Formula := '=RAND()';
>
> You can access cells with row and column numbers or variables, like this:
> var
> Row, Col: integer;
> ...
> WS.Cells.Item[1, 1].Value := 'The very first cell';
> WS.Cells.Item[Row, Col].Value := 'Some other cell';
Steve Aish wrote:
>
> Hey guys,
>
> Here's an easy one for you. How does one open up an excel spreadsheet and
> fill in some cells.
>
> I have got this so far after about 3 hours of tearing my hair out trying to
> read the Delphi help file....
>
> var
> Icid : Integer;
>
> begin
> Icid := $1409;
>
> ExcelApplication1.Connect;
> ExcelApplication1.Visible[Icid] := True;
> ExcelApplication1.Caption := 'WE are now linked to Excel!!';
>
> ExcelApplication1.Workbooks.Add(EmptyParam,Icid); // This line not
> necessary I think
> ExcelWorkBook1.ConnectTo(ExcelApplication1.WorkBooks.Item[1]);
>
> ExcelWorkSheet1.ConnectTo(_WorkSheet(ExcelWorkBook1.Worksheets[1])); // I
> think?
>
> What's the next step?
>
> ExcelWorkSheet1.Cells[1,1] := 'Hello'; // ??????
>
> Why oh why does Delphi not write a help manual that actually makes sense????
>
> I can do it with a word document - there is a step by step demo but none for
> excel.
>
> Thanks in advance,
>
> Steve Aish
> ---------------------------------------------------------------------------
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/