Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uses comobj;
- var
- Excel: Variant;
- Linha, CN: Integer;
- arq : TFileName;
- begin
- Excel := CreateOleObject('Excel.Application');
- Excel.Visible := false;
- OpenDialog1.Execute;
- arq := OpenDialog1.FileName;
- Excel.WorkBooks.Open(arq);
- Linha:=3;
- StringGrid1.RowCount := 1;
- StringGrid1.ColCount := 4;
- StringGrid1.Cells[1,0] := 'BOLETO';
- StringGrid1.Cells[2,0] := 'VALOR';
- CN := 1 ;
- While Linha < 1000 Do
- begin
- StringGrid1.RowCount := CN;
- StringGrid1.Cells[0,CN] := IntToStr(CN);
- StringGrid1.Cells[1,CN] := Excel.WorkBooks[1].Sheets[1].Cells[LINHA,1];
- StringGrid1.Cells[2,CN] := Excel.WorkBooks[1].Sheets[1].Cells[LINHA,3];
- IF Length(StringGrid1.Cells[1,CN]) = 0 THEN
- begin
- Excel.quit ;
- EXIT ;
- end ;
- CN := CN + 1 ;
- linha := linha + 2 ;
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment