Einzelnen Beitrag anzeigen

T3rm1

Registriert seit: 22. Jan 2007
8 Beiträge
 
Delphi 2009 Professional
 
#7

Re: [FEHLER] PowerPoint mit Delphi ansteuern

  Alt 9. Mär 2009, 18:02
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) = '.pptxthen
      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?
  Mit Zitat antworten Zitat