procedure TForm1.startClick(Sender: TObject);
begin
try
wordapplication1.connect;
except
messagedlg('word may not be installed', mterror, [mbok], 0);
abort;
end;
wordapplication1.visible := true;
wordapplication1.caption := 'delphi automation';
open.Enabled:=true;
end;
procedure TForm1.openClick(Sender: TObject);
var
Itemindex, format,TempEmpty: olevariant;
filename, passworddocument, passwordtemplate: olevariant;
writepassworddocument, writepasswordtemplate: olevariant;
confirmconversions, readonly, revert, addtorecentfiles: olevariant;
begin
filename:='c:/temp.DOC';
confirmconversions := false;
readonly := false;
addtorecentfiles := false;
revert := true;
passworddocument := '';
passwordtemplate := '';
writepassworddocument := '';
writepasswordtemplate := '';
format := wdopenformatdocument;
wordapplication1.documents.open(filename, confirmconversions,
readonly, addtorecentfiles, passworddocument, passwordtemplate,
revert, writepassworddocument, writepasswordtemplate, format,TempEmpty,TempEmpty);
end;