ExcelApp:=CreateOLEObject('Excel.Application'); //Since D5
you can replace this with the Excel server


               ExcelApp.Workbooks.Open(ExcelFileName,0,False);
           ExcelApp.ActiveWorkbook.Worksheets.Item(1).Activate;

[...]

procedure TMainForm.WriteCellString(CRow,CCol:integer;Data:String);
begin
     ExcelApp.Goto('R'+IntToStr(CRow)+'C'+IntToStr(CCol));
     ExcelApp.ActiveCell.Value:=Data;
end;



> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Steve Aish
> Sent: Monday, 16 July 2001 17:35
> To: Multiple recipients of list delphi
> Subject: [DUG]: Ole Automation Server
>
>
> 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/

Reply via email to