如何用DDE连接Word啊?,,,,我给分很快的,,,只要解决问题,我马上给分,,
unit Unit1;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, DdeMan;
type
TForm1 = class(TForm)
DdeConv: TDdeClientConv;
Word: TButton;
procedure WordClick(Sender: TObject);
private
public
end;
{DdeConv properties are : }
{ ConnectMode : ddeManual }
{ DdeService : [None] }
{ Ddeic : [None] }
{ FormatChars : False }
{ Name : DdeConv }
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.WordClick(Sender: TObject);
begin
if DdeConv.SetLink( WINWORD, D:\WINWORD\DDETEST ) and
DdeConv.OpenLink then
begin
ShowMessage( Link with WinWord established ! ) ; { be sure the link exist }
DdeConv.PokeData( Bm1, Data from Delphi ! ) ; { insert Data from Delphi in word document }
DdeConv.CloseLink ;
end ;
end;
end.