これが「意図された」ものなのか、それとも (プレゼンテーションを表示する以外の) 回避策が存在するのかはわかりません。
#if DEBUG
var withWindow = Microsoft.Office.Core.MsoTriState.msoTrue;
#else
// using msoTrue fixes the error
var withWindow = Microsoft.Office.Core.MsoTriState.msoFalse;
#endif
presentation = app.Presentations.Open(templateFileName,
Microsoft.Office.Core.MsoTriState.msoTrue, // readonly
Microsoft.Office.Core.MsoTriState.msoFalse, // untitled (?)
withWindow // with window: visible or not
);
// some time later...
slide.Shapes.AddChart(); // Error HRESULT E_FAIL has been returned from a call to a COM component. ErrorCode: -214747259
自動化の際に PowerPoint プレゼンテーションを非表示にできないのはかなり面倒です。この問題の回避策はありますか?