Доброе утро.
Не получается разобратся с Word, не могу открыть новый документ. В диспетчере задач Winword.exe присутсвует, но новый документ не открывается, ошибок при компилировании нет.
Говорит что сервер RPC не доступен!
Где у меня ошибка, подскажите.
Код HTML:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleServer, Word2000;
type
TForm1 = class(TForm)
Button1: TButton;
MSWord: TWordApplication;
WordDocument1: TWordDocument;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses ComObj;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
Word, WordDocument1 : variant;
begin
Word := CreateOleObject('Word.Application');
MSWord.Connect;
MSWord.Documents.Add(EmptyParam, EmptyParam, EmptyParam,EmptyParam);
WordDocument1.ConnectTo(MSWord.ActiveDocument);
MSWord.Visible := True;
end;
end.