X
xxok2001
Unregistered / Unconfirmed
GUEST, unregistred user!
var
ExcelApp: Variant;
i,j:integer;
begin
ExcelApp := CreateOleObject( 'Excel.Application' );
ExcelApp.WorkBooks.Add;
ExcelApp.WorkSheets[1].Activate;
adoquery1.First;
for i:=0 to adoquery1.recordcount-1 do
begin
for j:=0 to DBGrid1.Fieldcount-1 do
begin
ExcelApp.Cells[i+1,j+1].Value := dbgrid1.fields[j].AsString;
end;
end;
ExcelApp.saveAs( 'E:/Demo1.xls' );
ExcelApp.WorkBooks.Close;
ExcelApp.Quit;
end;
以上是源码,可另存时是有问题,提示方法saveAs不被支持。还请高手赐教,代码中存在的
问题和不规范的地方。谢谢
ExcelApp: Variant;
i,j:integer;
begin
ExcelApp := CreateOleObject( 'Excel.Application' );
ExcelApp.WorkBooks.Add;
ExcelApp.WorkSheets[1].Activate;
adoquery1.First;
for i:=0 to adoquery1.recordcount-1 do
begin
for j:=0 to DBGrid1.Fieldcount-1 do
begin
ExcelApp.Cells[i+1,j+1].Value := dbgrid1.fields[j].AsString;
end;
end;
ExcelApp.saveAs( 'E:/Demo1.xls' );
ExcelApp.WorkBooks.Close;
ExcelApp.Quit;
end;
以上是源码,可另存时是有问题,提示方法saveAs不被支持。还请高手赐教,代码中存在的
问题和不规范的地方。谢谢