unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Word2000, OleServer, StdCtrls;
type
TForm1 =
class(TForm)
Button1: TButton;
WordApplication1: TWordApplication;
WordDocument1: TWordDocument;
WordFont1: TWordFont;
WordParagraphFormat1: TWordParagraphFormat;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
FileName: OleVariant;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
WordApplication1.Connect;
FileName := '
e:\Delphi\Word\01.doc';
WordApplication1.Documents.Open(FileName, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam,
EmptyParam, EmptyParam, EmptyParam, EmptyParam);
WordApplication1.visible := true;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
vAlt, vNeu: Variant;
begin
WordDocument1.ConnectTo(WordApplication1.ActiveDocument);
vAlt := '
01.';
vNeu := '
Januar';
WordApplication1.Selection.Find.Execute(vAlt,EmptyParam,
EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,
EmptyParam,EmptyParam,
vNeu,EmptyParam);
end;
end.