unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, word_tlb, comobj,
activex;
type
TForm1 =
class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
MSWord: Variant;
begin
try
MsWord := GetActiveOleObject('
Word.Application');
except
try
MsWord := CreateOleObject('
Word.Application');
MsWord.Visible := True;
except
Exception.Create('
Error');
end;
end;
MSWord.Selection.WholeStory;
MSWord.Selection.copy;
MSWord.Documents.Add;
MSWord.Selection.Paste;
MSWord.ActiveDocument.SaveAs('
C:\neu.doc');
end;
end.