G
gaoliang80
Unregistered / Unconfirmed
GUEST, unregistred user!
uses
Windows,Messages,SysUtils,Classes,Graphics,Controls,Forms,Dialogs,StdCtrls,ComObj,Excel97, OleServer, Db, DBTables;
procedure TForm1.Button1Click(Sender: TObject);
var eclApp,WorkBook:Variant;
begin
try
eclApp:=CreateOleObject('Excel.Application');
WorkBook:=CreateOleobject('Excel.Sheet');
except
ShowMessage('您的机器里未安装Microsoft Excel.');
Exit;
end;
if OpenDialog1.execute then
WorkBook:=eclApp.workBooks.Open(OpenDialog1.filename);
edit1.text:=eclApp.Cells(2,1);
WorkBook.save;
WorkBook.Close;
eclApp.Quit;
eclApp:=Unassigned;
end;
end.
我想得到excel中二行一列的值,实际上在excel中存在,可运行是却报错:
找不到成员,请问为什么?
Windows,Messages,SysUtils,Classes,Graphics,Controls,Forms,Dialogs,StdCtrls,ComObj,Excel97, OleServer, Db, DBTables;
procedure TForm1.Button1Click(Sender: TObject);
var eclApp,WorkBook:Variant;
begin
try
eclApp:=CreateOleObject('Excel.Application');
WorkBook:=CreateOleobject('Excel.Sheet');
except
ShowMessage('您的机器里未安装Microsoft Excel.');
Exit;
end;
if OpenDialog1.execute then
WorkBook:=eclApp.workBooks.Open(OpenDialog1.filename);
edit1.text:=eclApp.Cells(2,1);
WorkBook.save;
WorkBook.Close;
eclApp.Quit;
eclApp:=Unassigned;
end;
end.
我想得到excel中二行一列的值,实际上在excel中存在,可运行是却报错:
找不到成员,请问为什么?