Ok, also, das Problem lässt sich eingrenzen. Folgender Code lies sich ohne Probleme auf zwei anderen Systemen ausführen (einer Office 11, einer Office 12). Auf
meinem System kommt aber nach wie vor der gleiche Fehler:
Delphi-Quellcode:
procedure PPT2Image(Path: string);
var PowerPoint: PowerPointApplication;
AppWasRunning: Boolean;
OleResult: HRESULT;
Unknown: IUnknown;
begin
AppWasRunning := False;
OleResult := GetActiveObject(CLASS_PowerPointApplication, nil, Unknown);
if (OleResult = MK_E_UNAVAILABLE) then
PowerPoint := CoPowerPointApplication.Create
else begin
OleCheck(OleResult);
OleCheck(Unknown.QueryInterface(PowerPointApplication, PowerPoint));
AppWasRunning := True;
end;
try
if ExtractFileExt(Path) = '.pptx' then
PowerPoint.Presentations.Open2007(Path, msoTrue, msoFalse, msoFalse, msoFalse)
else
PowerPoint.Presentations.Open(Path, msoTrue, msoFalse, msoFalse);
PowerPoint.Presentations.Item(1).SaveAs(ExtractFilePath(Path) + 'blub.png', ppSaveAsPNG, msoFalse);
PowerPoint.Presentations.Item(1).Close;
finally
if not AppWasRunning then
PowerPoint.Quit;
end;
end;
Hat jemand eine Idee, wo bei meiner Office Installation der Fehler liegen könnte?