Главная страница | назад





Article #17218: Automating Word 7

 Question and Answer Database

FAQ2218D.txt   Automating Word 7
Category   :ActiveX/OLE/COM/ActiveForm
Platform    :All
Product    :All 32 bit  

Question:
How do I automate Word 7?

Answer:
You can get to any of the interfaces exposed by the word 
automation server. These can be found by loading MSWORD8.OLB 
into Delphi which will display the type library information. 
You can also use the Application's WordBasic property to get 
at the VB used in Word. The following sample demonstrates both
avenues: 

implementation

uses ComObj;

{$R *.DFM}

var
  V: OleVariant;

procedure TForm1.Button1Click(Sender: TObject);
begin
  V := CreateOleObject('Word.Application');
  V.ShowMe;
  V.WordBasic.FileNew;
  V.WordBasic.Insert('test');
  V.Run('mymac');
  V.WordBasic.FileSave;
end;

end.

7/16/98 4:31:28 PM
 

Last Modified: 01-SEP-99