Jump to content

Recommended Posts

Posted

Merhabalar,

Excel'den verileri okumak istiyorum.

 

 

  AStream: TFileStream);
var
  Excel: Variant;
  WorkSheet : Variant;
  s: string;
begin
  try
  try
    Excel := CreateOleObject('Excel.Application');
    Excel.Visible := False;
    Excel.Workbooks.Open(AStream.FileName);
    memo.Lines.Add('File loaded');
    WorkSheet := Excel.Workbooks[1].WorkSheets[1];
    s := WorkSheet.Cells[1, 1];
    memo.Lines.Add(Format('[1,1]="%s"', [s]));
  except
    on E: Exception do memo.Lines.Add('Error in Excel: ' + E.Message);
  end;
  finally
    if not VarIsEmpty(Excel) then Excel.Quit;
  end;

Bunun için yukarıdaki kod'u kullandım. Normalde sıkıntısız çalışıyor. Ama Dll olarak çalıştırınca 

 Erişim engellendi, ProgID: "Excel.Application"

 

 

Hatasını alıyorum.

Excel'den verileri nasıl okuyabilirim acaba?

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...