작은용량은 문제 없이 열리고 읽습니다...
하지만 용량이 큰것은 읽다가 죽더군요..ㅜㅜ
살려주세요~
procedure TForm1.ExcelToDB(Sender: TObject);
var
XL, WorkBK, WorkSheet : Variant;
sFileName : String;
i, j : Integer;
nRow, nCol : Integer;
tempArry : Array[1..9] of String;
begin
try
XL := CreateOLEObject('Excel.Application'); // 엑셀을 실행
except
ShowMessage('Excel이 설치되어 있지 않습니다!!!');
Exit;
end;
XL.DisplayAlerts := False;
XL.Visible := False;
XL.WorkBooks.Open(sFileName);
WorkBK := XL.WorkBooks.item[1];
WorkSheet := WorkBK.WorkSheets.Item[1]; // Sheet의 셀단위로
for i := 1 to 9 99 do
if XL.Cells[1,i].Formula = '' then begin
nCol := i-1;
Break; ;
end;
nRow := XL.ActiveSheet.UsedRange.Rows.Count;
for j := 1 to nRow do begin
for i := 1 to nCol do
tempArry[i] := '';
for i := 1 to nCol do
// tempArry[i] := XL.Cells[j,i].Formula;
tempArry[i] := WorkSheet.Cells[j,i];
edtDestFile.Text := IntToStr(j);
end;
end;
XL.WorkBooks.Close;
XL.Quit;
XL := UnAssigned;
Finalize(WorkSheet);
Finalize(WorkBK);
Finalize(XL);
end;