this slowpoke moves

Export Strings to Excel File

uses ComObj, OleServer, ExcelXP

//

function EXCELStarten (var my_EXCEL : Variant): boolean;
{erfordert in uses: comobj}
begin
   try
    my_EXCEL := CreateOLEObject('Excel.Application');
    Result := TRUE;
  except
    ShowMessage('Excel konnte nicht gestartet werden!');
    Result := FALSE;
    Exit
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
var Excel : Variant;
begin
  EXCELStarten(Excel);
  Excel.Visible := False;
  Excel.Application.Workbooks.Add;
  Excel.Worksheets ['Tabelle1'].Activate;
  Excel.cells[1,1]:= Edit1.Text;             // Text
  Excel.cells[1,2]:= StrToFloat(Edit2.Text); // Zahl
  Excel.cells[2,1]:= Edit3.Text;             // Text
  Excel.cells[2,2]:= StrToFloat(Edit4.Text); // Zahl
  Excel.cells[3,1]:= Edit5.Text;             // Text
  Excel.cells[3,2]:= StrToFloat(Edit6.Text); // Zahl
  Excel.Quit;
end; 

Keine Kommentare:

Kommentar veröffentlichen

Beliebte Posts

Translate