Activex OLE Delphi

Title: Work with word document
This example shows, how to run MS Word, open *.doc file and insert some string to this file, save and close document.
Don't forget add ComObj in uses chapter.
uses
ComObj;
...
var
Word: Variant;
...
procedure TForm1.Button1Click(Sender: TObject);
begin
Word:=CreateOLEObject('Word.Application');
Word.Visible:=True;
Word.Documents.Open(GetCurrentDir+'\Test.doc');
Word.WordBasic.Insert('Greatis ');
Word.Documents.Save;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Word.Documents.Close;
end;