uses Comobj, Word2000;
var
Word_Handle, Doc_Handle: OleVariant;
procedure TForm1.Button1Click(Sender: TObject);
begin
try
Word_Handle := GetActiveOleObject('Word.Application');
except
try
Word_Handle := CreateOleObject('Word.Application');
except
end;
end;
Word_Handle.Visible := True;
Doc_Handle := word_Handle.Documents.open(FileName := 'C:/1.doc', ReadOnly := False, AddToRecentFiles := False);
Doc_Handle.Application.Selection.Find.ClearFormatting;
Doc_Handle.Application.Selection.Find.Replacement.ClearFormatting;
Doc_Handle.Application.Selection.Find.Text:='aaa';
Doc_Handle.Application.Selection.Find.Replacement.Text:='bbb';
Doc_Handle.Application.Selection.Find.Execute(Replace := wdReplaceAll);
Doc_Handle.Application.Selection.Find.Execute;
end;