G
gaoren
Unregistered / Unconfirmed
GUEST, unregistred user!
我想用delphi用word打开一个word文件。当我关闭word应用程序时再次执行程序可是老是出问题
procedure TForm1.Button1Click(Sender: TObject);
var a:OleVariant;
begin
a:='c:/ggj.doc';
if not wordapplication1.visible then
begin
WordApplication1.Connect;
WordApplication1.Visible:=true;
end;
WordDocument1.Connectto(WordApplication1.Documents.Open(a,EmptyParam,emptyparam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam));
end;
procedure TForm1.WordDocument1Close(Sender: TObject);
begin
wordapplication1.Quit;
end;
end.
有没有解决的办法呢?
procedure TForm1.Button1Click(Sender: TObject);
var a:OleVariant;
begin
a:='c:/ggj.doc';
if not wordapplication1.visible then
begin
WordApplication1.Connect;
WordApplication1.Visible:=true;
end;
WordDocument1.Connectto(WordApplication1.Documents.Open(a,EmptyParam,emptyparam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam));
end;
procedure TForm1.WordDocument1Close(Sender: TObject);
begin
wordapplication1.Quit;
end;
end.
有没有解决的办法呢?