uses Word_TLB;Many parameters passed to Word methods are defined as optional parameters. When using interfaces (typep libraries), Delphi does not allow you to left out any optional arguments. Delphi provides a variable which can be used for optional parameters that are not being used called EmptyParam.
...
var
WordApp : _Application;
WordDoc : _Document;
VarFalse : OleVariant;
begin
WordApp := CoApplication.Create;
WordDoc := WordApp.Documents.Add(EmptyParam, EmptyParam) ;
{
spell check code as described
later in this article
}
VarFalse:=False;
WordApp.Quit(VarFalse, EmptyParam, EmptyParam) ;
end;
To automate Word with a Variant variable (late binding) use this code:
uses ComObj;When using late binding, Delphi allows you to left out any optional arguments when calling methods (like Quit). You call methods and properties, as long as you know what they are.
...
var
WordApp, WordDoc: Variant;
begin
WordApp := CreateOleObject('Word.Application') ;
WordDoc := WordApp.Documents.Add;
{
spell check code as described
later in this article
}
WordApp.Quit(False)
end;


