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

  1. { NOTE: This program will only function correctly when the US version of
  2.   Microsoft Word is installed. }
  3.  
  4. unit Main;
  5.  
  6. interface
  7.  
  8. uses
  9.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  10.   StdCtrls, ExtCtrls;
  11.  
  12. type
  13.   TOleWordForm = class(TForm)
  14.     TalkToWord: TButton;
  15.     Image1: TImage;
  16.     procedure TalkToWordClick(Sender: TObject);
  17.   private
  18.     V: Variant;
  19.   public
  20.     { Public declarations }
  21.   end;
  22.  
  23. var
  24.   OleWordForm: TOleWordForm;
  25.  
  26. implementation
  27.  
  28. {$R *.DFM}
  29.  
  30. uses
  31.   OleAuto, Ole2;
  32.  
  33. procedure TOleWordForm.TalkToWordClick(Sender: TObject);
  34. begin
  35.   V := CreateOleObject('Word.Basic');
  36.   V.FileNew('Normal');
  37.   V.Insert('The mark of a healthy mind' + #13#10);
  38.   V.Insert('is freedom from its own ideas.');
  39.   V.FileSaveAs('C:\SEMPERFI.DOC',,,'Sammy');
  40. end;
  41.  
  42. end.
  43.