Windows with Delphi Windows API (94) Windows Filesystem (41) Windows Forms (69) Windows Graphics (38)
Exchange Links About this site Links to us 
|
Handle Excel through OLE Automation
This article has not been rated yet. After reading, feel free to leave comments and rate it.
The example below shows how to create and control an embedded Excel object.
In case of Delphi 3, you need to use unit OleAuto, in Delphi 5 you have to use ComObj instead.
A good additional source is here.
 | |  | | uses
OleAuto;
ComObj;
var
vExcel: variant;
procedure TForm1.Button1Click(Sender: TObject);
begin
vExcel := CreateOleObject('Excel.Application');
vExcel.Workbooks.Add;
vExcel.ActiveWorkbook.Worksheets(1).Range('A1').Value := 'Hello World';
vExcel.Visible := True;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
if not VarIsEmpty(vExcel) then vExcel.Quit;
end; | |  | |  |
Comments:
|