procedure TForm1.Button1Click(Sender: TObject);
var
itemp,jtemp:integer;
begin
ExcelApplication1.Connect;//出错时,光标停留在这一行 ExcelApplication1.Visible[0]:=true;
ExcelWorkbook1.ConnectTo(ExcelApplication1.Workbooks.Add(EmptyParam,0));
ExcelWorksheet1.ConnectTo(ExcelApplication1.Worksheets[1] as _Worksheet);
jtemp:=1;
with AdoQuery1 do
begin
first;
while not eof do
begin
for itemp:=1 to fieldCount do
begin
ExcelWorksheet1.Cells.Item[jtemp,itemp]:=fields[itemp-1].AsString;
end;
inc(jtemp);
next;
end;
end;
end;
这个程序在一台机器上运行很好,没有问题,这是个例程,程序没问题。
可是我在另外一台机器上就发生错误Tolesyserror "没有注册类别" ( ExcelApplication1.Connect;//出错时,光标停留在这一行)
谢谢各位,第一次发帖~~
var
itemp,jtemp:integer;
begin
ExcelApplication1.Connect;//出错时,光标停留在这一行 ExcelApplication1.Visible[0]:=true;
ExcelWorkbook1.ConnectTo(ExcelApplication1.Workbooks.Add(EmptyParam,0));
ExcelWorksheet1.ConnectTo(ExcelApplication1.Worksheets[1] as _Worksheet);
jtemp:=1;
with AdoQuery1 do
begin
first;
while not eof do
begin
for itemp:=1 to fieldCount do
begin
ExcelWorksheet1.Cells.Item[jtemp,itemp]:=fields[itemp-1].AsString;
end;
inc(jtemp);
next;
end;
end;
end;
这个程序在一台机器上运行很好,没有问题,这是个例程,程序没问题。
可是我在另外一台机器上就发生错误Tolesyserror "没有注册类别" ( ExcelApplication1.Connect;//出错时,光标停留在这一行)
谢谢各位,第一次发帖~~
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货