Author: Lou Adler
How do I automate word 8 (aka word97)?
Answer:
You can get to any of the interfaces exposed by the word automation server. These
can be found by loading the file "MSWORD8.OLB" into Delphi which will display the
type library information. The following code sample demonstrates creating a new
word document and inserting text into the document via automation.
1 uses ComObj;
2 3 procedure TForm.Button Click(Sender: TObject);
4 var5 Word97: Variant;
6 begin7 Word97 := CreateOLEObject('Word.Application');
8 Word97.Documents.Add;
9 Word97.Selection.TypeText('Wow BOB woW');
10 Word97.Visible := True;
11 Word97 := UnAssigned;
12 end;