try
try
aOLE := GetActiveOleObject('
Word.Application');
except
aOLE := CreateOleObject('
Word.Application');
end;
aOLE.ScreenUpdating := False;
aOLE.Documents.Add(OpenDialog.FileName);
// hier Add statt Open
MyDoc := aOLE.ActiveDocument;
aOLE.ActiveDocument.MailMerge.MainDocumentType := wdNotAMergeDocument;
aOLE.ActiveDocument.MailMerge.OpenDataSource (ExpFilename, False, False, True);
aOLE.ActiveDocument.MailMerge.EditMainDocument;
aOLE.ActiveDocument.MailMerge.Execute;
MyDoc.Activate;
MyDoc.Close(0);
aOLE.Application.ScreenUpdating := True;
aOLE.Visible := True;
except
MessageDlg('
OLE Aktionen fehlerhaft.', mtInformation, [mbOK], 0);
aOLE.Quit(0);
end;