home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1999 February / DPPCPRO0299.ISO / February / Delphi / Runimage / DELPHI20 / DEMOS / DOC / OLEWORD1 / MAIN.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-06-10  |  850 b   |  46 lines

  1. unit Main;
  2.  
  3. { This program will not work unless Word is already
  4.   running. OLEWORD2.DPR shows how to get around
  5.   this limitation. }
  6.  
  7. { NOTE: This program will only function correctly with
  8.   the US version of Microsoft Word }
  9.  
  10. interface
  11.  
  12. uses
  13.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  14.   ExtCtrls, StdCtrls, Buttons;
  15.  
  16. type
  17.   TOleWordForm = class(TForm)
  18.     Image1: TImage;
  19.     TalkToWord: TBitBtn;
  20.     procedure TalkToWordClick(Sender: TObject);
  21.   private
  22.     { Private declarations }
  23.   public
  24.     { Public declarations }
  25.   end;
  26.  
  27. var
  28.   OleWordForm: TOleWordForm;
  29.  
  30. implementation
  31.  
  32. uses
  33.   OleAuto;
  34.  
  35. {$R *.DFM}
  36.  
  37. procedure TOleWordForm.TalkToWordClick(Sender: TObject);
  38. var
  39.   V: Variant;
  40. begin
  41.   V := CreateOleObject('Word.Basic');
  42.   V.Insert('Hello from Delphi');
  43. end;
  44.  
  45. end.
  46.