Показать сообщение отдельно
  #2  
Старый 26.08.2009, 08:02
Аватар для Rokuell
Rokuell Rokuell вне форума
Активный
 
Регистрация: 27.12.2006
Адрес: Псков
Сообщения: 274
Версия Delphi: Delphi 7
Репутация: 497
По умолчанию

У меня никаких ошибок не возникает, если сделать так:
Код:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, OleServer, WordXP, StdCtrls;

type
  TForm1 = class(TForm)
    MSWord: TWordApplication;
    WordDocument1: TWordDocument;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  MSWord.Connect;
  MSWord.Documents.Add(EmptyParam, EmptyParam, EmptyParam,EmptyParam);
  WordDocument1.ConnectTo(MSWord.ActiveDocument);
  MSWord.Visible := True;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
 WordDocument1.Close;
 WordDocument1.Disconnect;
 MSWord.Quit;
 MSWord.Disconnect;
end;

end.
__________________
Велик и могуч наш Object Pascal !
ICQ: 357-591-887
Ответить с цитированием