procedure TForm1.Button1Click(Sender: TObject);
begin
WordApplication1.Connect;
WordApplication1.Visible:=true;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
Template : OleVariant;
NewTemplate : OleVariant;
DocuType : OleVariant;
Visible : OleVariant;
begin
Template:=EmptyParam;
NewTemplate:=True;
DocuType:=1;//0表示创建的是模板,1表示创建的是文档,3表示打开OUTLOOK
Visible:=True;
try
WordApplication1.Documents.Add(Template,NewTemplate,DocuType,Visible);
except
Application.MessageBox('创建新文档失败!','提示信息',mb_okcancel+mb_iconinformation);
end;
end;