ado中的保存为excel的问题(100分)

  • 主题发起人 zhch1100
  • 开始时间
Z

zhch1100

Unregistered / Unconfirmed
GUEST, unregistred user!
在运行是出现错误
ole error 800A03EC 出错 环境为d6+office2000 (原来d5+office2000运行成功)
procedure Tfrmdir.Button1Click(Sender: TObject);
var
i,row: Integer;
null:variant;

begin
if RadioButton1.Checked then begin
if adoquery1.Active then
if SaveDialog1.Execute then
begin
Screen.Cursor:=crHourGlass;
ExcelApplication1.Connect;
ExcelApplication1.Workbooks.Add(null,0);
ExcelWorkSheet1.ConnectTo(ExcelWorkBook1.Sheets[1] as _WorkSheet);
if not adoQuery1.Active then
begin
adoQuery1.Open;
end;
for i:=0 to adoQuery1.Fields.Count-1 do
ExcelWOrkSheet1.Cells.Item[1,i+1]:=adoQuery1.Fields.FieldName;
row:=2;
while not adoQuery1.Eof do
begin
for i:=0 to adoQuery1.Fields.Count-1 do
begin
ExcelWOrkSheet1.Cells.Item[row,i+1]:=adoQuery1.Fields.AsString;
end;
row:=row+1;
adoQuery1.Next;
end;
ExcelWorkBook1.SaveCopyAs(SaveDialog1.FileName);
excelworksheet1.Cells.Clear;
ExcelWOrkBook1.Close(false);
ExcelApplication1.Disconnect;
ExcelApplication1.Quit;
Screen.Cursor:=crDefault;
Application.MessageBox('数据导出成功!','Information',0);
adoquery1.Close;
end;
end;
end;
 
各位大虾,请指点,急用!
 
在什么地方出错呢,你跟踪到出错的地方,再给我指出来,我再帮你看看。
 
问题已经解决
 
to :zhch1100

问题是怎么解决的 ?

我也遇到了类似的问题!
分不是问题。
 
顶部