RE: Excel and Word automation This works on my pc.
WordDocument1 is a TWordDocument,
procedure TForm1.Button1Click(Sender: TObject);, var, _x: Integer;, xOleVariant: OleVariant ;, begin, OleContainer1.CreateObject('WORD.Document', False);, OleContainer1.Run;, WordDocument1.ConnectTo( IDispatch(OleContainer1.OleObject)as _Document);, for _x := 1 To WordDocument1.CommandBars.Count do, begin, xOleVariant := _x ;, if (WordDocument1.CommandBars.Item[xOleVariant].Type_=0) then, begin, , WordDocument1.CommandBars.Item[xOleVariant].Set_Visible(False) ;, end;, end ;, OleContainer1.DoVerb(ovShow);, end;,
|