procedure TForm1.startword;
begin
if (wordapplication.Documents.Count <> 0 ) then
begin
messagedlg('请先关闭word!', mterror, [mbok], 0);
exit;
end; try
wordapplication.connect;
except
messagedlg('word 没有正确安装', mterror, [mbok], 0);
abort;
end;
wordapplication.visible := true;
wordapplication.caption := 'delphi automation';
end;
begin
if (wordapplication.Documents.Count <> 0 ) then
begin
messagedlg('请先关闭word!', mterror, [mbok], 0);
exit;
end; try
wordapplication.connect;
except
messagedlg('word 没有正确安装', mterror, [mbok], 0);
abort;
end;
wordapplication.visible := true;
wordapplication.caption := 'delphi automation';
end;
解决方案 »
- 窗口回调中,如何使按下这个Button时,能MessageBox??
- 为什么会有这样的异常?
- kol&mck 1.86.zip+KOLSocket 已经装了前面的,想装socket提示版本不对,请老手帮忙
- Intraweb发布的问题,高手低手都进来一下
- 何处可以下载installshield软件包,帮帮忙!
- 存取日期时,datetimepicker怎样与表连接?帮帮忙,不用第三控件。
- 请教动态联接数据库的语句
- 请教一个utf8编码转换错误
- 哪里有关于delphi嵌入汇编语言的详细介绍
- WIN2000没了启动画面...?
- 怎么为我继承的一个系统空间添加一个属性阿,
- 我知道一个treeview的text,我如何得到text对应的treenode?
var
savechanges, originalformat, routedocument: olevariant;
begin
savechanges := wdSaveChanges;
originalformat := unassigned;
routedocument := unassigned;
try
wordapplication.quit(savechanges, originalformat, routedocument);
wordapplication.disconnect;
except
on e: exception do
begin
showmessage(e.message);
wordapplication.disconnect;
end;
end;
end;