unit Unit1;
interface
uses
... ActiveX, ComObj, PowerPoint_TLB, Office_TLB;
type
TForm1 = class(TForm)
Button1: TButton;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
PowerPointApp: OLEVariant;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
try
PowerPointApp:= CreateOleObject('PowerPoint.Application');
except
ShowMessage('Error Powerpoint...');
exit;
end;
PowerPointApp.Visible:= True;
PowerPointApp.Presentations.Open('E:\LPT_2\Report_made.ppt', False, False, True);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
PowerPointApp.Presentations.Item(1).Slides.Item(4).Select;
PowerPointApp.Presentations.Item(1).Slides.Item(4).Shapes.Item(3).Select;
if PowerPointApp.ActiveWindow.Selection.SlideRange.Shapes.Type = msoPicture then
ShowMessage('Сработало!')
else
ShowMessage('Не то!');
end;
end.