笨
笨笨了
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TFtj.SpeedButton13Click(Sender: TObject);
var
MSExce3: Variant;
i,j: Integer;
begin
OpenDialog1.Filter:='*.XLS|*.XLS';
OpenDialog1.DefaultExt:='XLS';
if OpenDialog1.Execute then
begin
MSExce3:=CreateOLEObject('Excel.Application');
MSExce3.WorkBooks.Add;
for i:=0 to SG1.RowCount-1 do
for j:=0 to SG1.ColCount-1 do
MSExce3.Cells[i+1,j].Value:=SG1.Cells[j,i];
MSExce3.ActiveWorkbook.SaveAs(OpenDialog1.FileName);
MSExce3.ActiveWorkBook.Close;
MSExce3.Quit;
end;
end;
就这两段基本一样的代码,在两个不同的地方,一个很好,另外一个却报:OLE error 800A03CE 错误。却是为何???
var
MSExce3: Variant;
i,j: Integer;
begin
OpenDialog1.Filter:='*.XLS|*.XLS';
OpenDialog1.DefaultExt:='XLS';
if OpenDialog1.Execute then
begin
MSExce3:=CreateOLEObject('Excel.Application');
MSExce3.WorkBooks.Add;
for i:=0 to SG1.RowCount-1 do
for j:=0 to SG1.ColCount-1 do
MSExce3.Cells[i+1,j].Value:=SG1.Cells[j,i];
MSExce3.ActiveWorkbook.SaveAs(OpenDialog1.FileName);
MSExce3.ActiveWorkBook.Close;
MSExce3.Quit;
end;
end;
就这两段基本一样的代码,在两个不同的地方,一个很好,另外一个却报:OLE error 800A03CE 错误。却是为何???