procedure TForm1.Button1Click(Sender: TObject);
var
V : Variant;
i,j : integer;
begin
screen.cursor := crHourGlass;
try
v:= CreateOleObject('Excel.Application');
except
MessageDlg('Excel이 설치되어 있지 않습니다.', MtWarning, [mbok], 0);
Exit;
End;
v.WorkBooks.add;
table1.DisableControls;
Table1.First;
for i := 0 to Table1.RecordCount do
begin
for j := 1 to DBGrid1.FieldCount do
begin
V.Cells[i+1,j].Value := Table1.fields[j-1].AsString;
end;
Table1.Next;
end;
table1.EnableControls;
screen.cursor := crDefault;
다른사람이 코딩을 해주면.. 어떤 의미가 있을까요..ㅎㅎ::
아래 내용을 참고하셔서 직접 작업해보세요..
procedure TForm1.Button1Click(Sender: TObject);
var
V : Variant;
i,j : integer;
begin
screen.cursor := crHourGlass;
try
v:= CreateOleObject('Excel.Application');
except
MessageDlg('Excel이 설치되어 있지 않습니다.', MtWarning, [mbok], 0);
Exit;
End;
v.WorkBooks.add;
table1.DisableControls;
Table1.First;
for i := 0 to Table1.RecordCount do
begin
for j := 1 to DBGrid1.FieldCount do
begin
V.Cells[i+1,j].Value := Table1.fields[j-1].AsString;
end;
Table1.Next;
end;
table1.EnableControls;
screen.cursor := crDefault;
V.Visible := True;
end;