delphi5中打开excel文档的问题
ibicf 2004-09-28 03:39:43 情况是这样的,我想通过点击按钮打开opendialog,然后选择excel文件,问题是这样,我现在写了段代码第一次打开excel文档没有问题,但是要使我关掉excel后再打开excel文件,文件就显示不出来了,请各位给点意见
代码
var
sDir: String;
sFileName: String;
begin
sDir := 'c:\';
OpenDialog1.InitialDir := sDir;
if OpenDialog1.Execute then
begin
try
try
sFileName := OpenDialog1.FileName;
//excelapplication是拖放到界面上的
ExcelApp.Workbooks.Open(sFileName,null,null,null,null,null,null,
null,null,null,null,null,null,0);
ExcelApp.Visible[1] := true;
except
end;
finally
end;
end;
end;