操作Excel的问题 未设置对象变量或With block变量
钞票搬运工 2019-01-09 03:39:13 procedure output_excel_file(file_path:string;report_type:Toutput_report_type;report_CDS:TADOQUERY);
var
Ecloum,Erow,row1,row2,i:integer;
Excel_application:variant;
strFormat:OleVariant;
begin
try
Excel_application:=createoleobject('Excel.application');
Excel_application.workbooks.add;
except
application.MessageBox('excel没有安装请检查','worng',mb_iconerror+mb_ok);
Excel_application.quit;
Excel_application:=unassigned;
exit;
end;
............................................
................................................
Excel_application.workbooks[1].SaveAs(file_path);
end;
工具:Delphi2010
环境:windows7 office2010 plus
运行到:
Excel_application.workbooks[1].SaveAs(file_path);
时;
报错
运行时错误"91"
未设置对象变量或With block变量
请大家帮看看该如何决绝。谢谢!