[阅读: 835] 2008-08-12 11:37:07
use COMObj, Office2000, PowerPointXP;
其中 Office2000, PowerPointXP 在 C:\Program Files\Borland\Delphi7\Ocx\Servers
procedure TForm1.Button3Click(Sender: TObject);
var
PP: Variant;
EM: OleVariant;
begin
try
PP := GetActiveOleObject('PowerPoint.Application'); //如果 PowerPoint 已经运行,则这句话就拿到了.
except
PP := CreateOleObject('PowerPoint.Application'); //如果 PP 没运行,则走到这里来.
end;
PP.Visible := True; //一定要 True ,没显示出来,以下操作都不行.
PP.Presentations.Open('C:\123.ppt', msoFalse, msoFalse, msoTrue);
EM := False;
PP.ActivePresentation.SaveAs('C:\1234.EMF', ppSaveAsEMF, EM);
PP.ActivePresentation.Close; //关掉打开的文件
PP.Quit;//关掉PP 程序
end;