我现在要做的软件中要将一些数据从Excel中读入,和写入Excel表中?但是在某些表的操作中,对于Excel2000可以使用,但是Excel2003就不能使用了?同样,将这些在2000中可以打开的表,在2003也不能打开。
我用的编程方式是 定义Variant类型的变量进行操作Excel。
ExcelApp: Variant;
...
...
ExcelApp := CreateOLEObject('Excel.Application');
ExcelApp.Visible := false;
ExcelApp.WorkBooks.Open(filename);
ExcelApp.WorkSheets[1].Activate; 请问用什么方法,才能使其对Excel2003也可以操作呢?
我用的编程方式是 定义Variant类型的变量进行操作Excel。
ExcelApp: Variant;
...
...
ExcelApp := CreateOLEObject('Excel.Application');
ExcelApp.Visible := false;
ExcelApp.WorkBooks.Open(filename);
ExcelApp.WorkSheets[1].Activate; 请问用什么方法,才能使其对Excel2003也可以操作呢?
解决方案 »
- cxgrid多线程如何操作?
- ADOQueryTmp.Locate('itembm',copy(m,1,4), [loPartialKey]) 解释一下什么意思
- 各位大虾,如何用程序将*.txt文件的内容导入sql的表中?
- 数据库能不能用dll啊?
- 谁知道这个提示意思?
- 怎么添加一个菜单项到Windows的系统菜单 ??
- 还是sql
- 从BDE改为用ADO连接后,对数据库(Access)的更新操作出现了"[Microsoft][ODBC Microsoft Access Driver]非法的精确读数值"的提示,这是为什么啊?
- 4个问题
- 关于动态报表的问题
- 我调用dll文件修改数据库的记录为何有误
- csdn 越做越不象话了?
var
Curexcel: string;
begin
Result := True;
Curexcel := GetRegStringValue('\Excel.Application\CurVer','');
if Curexcel = '' then
begin
Application.MessageBox('请先安装 excel 97 或 excel 2000!或 excel XP',
PChar(self.Caption), MB_OK + MB_ICONSTOP);
Result := False;
Exit;
end; if (Curexcel <> 'Excel.Application.8') and (Curexcel <> 'Excel.Application.9') then
begin
Curexcel := GetRegStringValue('\Excel.Application.10', '');
if Curexcel <> '' then Curexcel := 'Excel.Application.10';
if Curexcel = '' then
begin
Application.MessageBox('无法运行 excel 97 或 excel 2000,' + #13#10
+ '请检查 excel 97 或 excel 2000 是否已经正确安装。',
PChar(self.Caption), MB_OK + MB_ICONSTOP);
Result := False;
Exit;
end;
end; try
Fexcel := CreateOleObject(Curexcel);
if VarIsEmpty(Fexcel) then
begin
Application.MessageBox('无法运行 excel 97 或 excel 2000,' + #13#10
+ '请检查 excel 97 或 excel 2000 是否已经正确安装。',
PChar(self.Caption), MB_OK + MB_ICONSTOP);
Result := False;
Exit;
end;
except
Application.MessageBox('无法运行 excel 97 或 excel 2000,' + #13#10
+ '请检查 excel 97 或 excel 2000 是否已经正确安装。',
PChar(self.Caption), MB_OK + MB_ICONSTOP);
Result := False;
Exit;
end;
end;
请大家说具体一点好吗?我不清楚啊!
我用的编程方式是 定义Variant类型的变量进行操作Excel。
ExcelApp: Variant;
...
...
ExcelApp := CreateOLEObject('Excel.Application');
ExcelApp.Visible := false;
ExcelApp.WorkBooks.Open(filename);
ExcelApp.WorkSheets[1].Activate; 请问用什么方法,才能使其对Excel2003也可以操作呢?