function tForm1.DokumentOeffnen(
aWordDocument : TWord11Document;
aDateiname :
String;
aVisible : Boolean = false) : Boolean;
var
vDateiname : OleVariant;
vVisible : OleVariant;
vFalse : OleVariant;
begin
try
vDateiname := aDateiname;
vVisible := aVisible;
vFalse := False;
WordApplication.Connect;
WordApplication.Documents.Open(vDateiname, EmptyParam, vFalse, vFalse,
EmptyParam, EmptyParam, EmptyParam, EmptyParam,
EmptyParam, EmptyParam, EmptyParam, vVisible,
EmptyParam, EmptyParam, EmptyParam, EmptyParam);
aWordDocument.ConnectTo(WordApplication.ActiveDocument);
Result := True;
except
on e :
Exception do begin
Result := False;
end;
end;
end;